-
Notifications
You must be signed in to change notification settings - Fork 526
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 your account
feat: Include ORM associations in CollectionDecorator #845
Conversation
spec/draper/query_methods_spec.rb
Outdated
before { allow(fake_strategy).to receive(:allowed?).with(:foo).and_return(true) } | ||
|
||
it 'calls the method' do | ||
allow(instance).to receive(:foo) |
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.
this can't be on the before?
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.
I prefer to write the specs using the format: setup/exercise/verify.
expect(Draper.default_controller).to be ApplicationController | ||
end | ||
|
||
it 'allows customizing default_controller through configure' do |
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.
Did you want to write allows customizing default_controller through configuration
?
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.
Or even, through Draper#configure
, through configure method
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.
I'm not sure 🤔. I've just moved this old tests into a context, maybe these changes are out the scope of this pr?
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.
Hey guys, this looks good. I left some feedback below. I'll probably continue to play around with it over the weekend, but I think you can expect it to be merged by the end of the weekend.
Hey @codebycliff. Thanks for your feedback! 😃 |
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.
Looks great! I have a couple applications running Draper master
currently. I'll probably hold off on cutting a release to RubyGems for a week or two to make sure everything is good.
Description
Include all QueryMethods from the ORM in CollectionDecorator. The default strategy is :active_record
It was necessary to delegate or define a method of the ORM which you are using in your decorator to make an instance of CollectionDecorator able to call it.
In order to support other ORM associations, we'll need to write a method
allowed?
for each strategy atlib/draper/query_methods/load_strategy.rb
Testing
References