-
Notifications
You must be signed in to change notification settings - Fork 527
Activerecord relations #610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to 8000 your account
Conversation
@@ -49,15 +49,15 @@ def decorated? | |||
|
|||
module ClassMethods | |||
|
|||
# Decorates a collection of objects. Used at the end of a scope chain. | |||
# Decorates an activerecord relation. Used at any point of the scope chain. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ActiveRecord
I really like this idea overall. I don't have enough time to give it a proper review right now, though. :/ |
Could you rebase this, please? I've updated the travis file to actually build the correct rubies, and I'd like to see if it passes. Thanks! |
…et/draper into activerecord-relations
Looks like it isn't passing. I'll have some free time after wednesday so will look into getting everything passing. |
Well that was easier than expected. Seems to be passing now. |
I confirm it works very well. Thanks @donaldpiret ! |
Any idea when this will be merged? I'm having an issue where I do @current_user = User.find(user_id).decorate. But then when I call @current_user.some_associated_model, it's telling me that the method doesn't exist. This pull request seems like it would fix that... |
It no longer merges correctly, and needs a rebase |
@magicmarkker Thanks for the head's-up. I'll try to rebase it later today or tomorro 8000 w when I have a bit of time. |
…et/draper into activerecord-relations Conflicts: lib/draper.rb
@magicmarkker @steveklabnik Rebased. Some of the builds are failing on Travis but those don't seem to have anything to do with my changes, and apparently has been failing since https://travis-ci.org/drapergem/draper/builds/35338408 |
|
Done! |
I'm interested in this. Let's see if we can get it passing on CI. |
I'll try to spend some time on this tomorrow to bring it up to date. Using my branch in production so would love to see it merged in as well. |
Getting one failure with mongoid. Not super familiar with it so might take me a little bit of time to get around. |
Closing in favor of cleaned up version: #662 |
👍 @donaldpiret, DecoratorRelation will be able to do |
Better handling of activerecord relations. One can now call the decorator anywhere in the scope chain, and keep your relation decorated. Once you call methods that access individual records or arrays of records it automatically converts your result to a collection decorator or a regular decorator.
Would love to get some feedback on this.