Giter Site home page Giter Site logo

Comments (8)

nesquena avatar nesquena commented on August 15, 2024 3

@tagliala Sent me a PR, I merged and released the fix as 0.14.3! I've also marked you as a contributor @tagliala if you can help keep RABL alive and well in whatever capacity you can, I appreciate it. That goes for anyone else reading this thread too.

Sorry that I haven't been able to maintain this much in the last few years, it is genuinely humbling that people still use this library, and sorry it isn't even better! I do still use this library myself extensively, I just have it locked to old versions of Sinatra and haven't needed any new features in a long time.

from rabl.

nesquena avatar nesquena commented on August 15, 2024 2

I’ll look into this soon, sorry to hear about that. Once I can confirm, I’ll yank 0.14.1 until this is resolved

from rabl.

tagliala avatar tagliala commented on August 15, 2024 2

Confirm this issue.

Problem is in commit: 4cf2c66

exactly this change: 4cf2c66#diff-5a71730235e40573daff6c167a927d5dR85-R89

because on Rails 4 an active record relation responds to both :map and :each but it is not an enumerable

[2] pry(main)> Document.all.respond_to?(:map)
=> true
[3] pry(main)> Document.all.respond_to?(:each)
=> true
[4] pry(main)> Document.all.is_a?(Enumerable)
=> false

Hope it helps

from rabl.

nesquena avatar nesquena commented on August 15, 2024 1

Sorry to hear about this, I am unfortunately no longer able to actively maintain RABL (which I first created many years ago now) as you probably gathered, though I still happily use an old version on several of my own apps. It's honestly amazing to me that it's still used as much as it is!

If anyone can point me to a PR, and a recommended course of action, I'd be more than happy to push a 0.14.2 to resolve this

from rabl.

swiknaba avatar swiknaba commented on August 15, 2024

Thanks! I created a sample app to reproduce the issue: https://github.com/swiknaba/rabl_0140

from rabl.

dmke avatar dmke commented on August 15, 2024

Same problem here.

We're presenting an ActiveRecord::Relation object in our templates:

# controller
@tags = Tag.where(...)

# template
object @tags
attributes :id, :name, :position

The workaround for this is converting the collection to an array (but that's obviously bad for performance):

object @tags.to_a

from rabl.

dramalho avatar dramalho commented on August 15, 2024

Yeah, I just bitten by this, locking the gem to 0.14.0 until either it's fixed or, presumably, I move to Rails > 4.2 and this is no longer an issue

from rabl.

tagliala avatar tagliala commented on August 15, 2024

@nesquena apologies are not necessary. Thank you for all these years, I've been using rabl since forever 🙏🏼

from rabl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.