amatsuda/active_decorator

association decoration conflagration

Closed this issue · 3 comments

ActiveDecorator generally does a nice job decorating active record associations, but there are gaps. For example:

author = ActiveDecorator::Decorator.instance.decorate(Author.first)
puts author.books.first.is_a?(ActiveDecorator::Decorated)      # => true
puts author.books.order(:id).first.is_a?(ActiveDecorator::Decorated) # => false

Same for includes. This is easy enough to workaround and I don't want to complicate the gem, but I figured I'd raise the issue so we can document the behavior and consider fixes.

Thanks for all your hard work on this gem!

That second line seems to be missing a .first after the .order call.

thx, fixed my pseudocode

@gurgeous Thank you so much for the suggestion!
I just published a new gem package versioned 1.3.0 with this author.books.order(:id).first.is_a?(ActiveDecorator::Decorated) support.
Could bundle update your app and try again?
Thanks!