Closed machisuke closed 2 years ago
Resolved by #256
I'm trying to think about the use case here.
I've only used a where scope in those instances. In your code, what do you put into the scope (that we were dropping and you added back?)
Thanks @machisuke I understand your use case. I worked on one project that was similar to that. (your example helped with my memory)
The where clauses on the scope makes a ton of sense. Wise to put that into the test case.
Can you rebase the 256 PR code out of here? Or do you need that to make these tests pass?
@kbrock
Actually, this PR needs #256.
Without #256, executing both spec/active_hash/base_spec.rb:1287
and. ./spec/associations/active_record_extensions_spec.rb:138
in a single process causes an error.
The detail is here
@machisuke thanks
If you could rebase this on master (to remove #256) that would be great.
@kbrock Sure.
@machisuke thanks
I merge another and introduced a conflict for this. sorry.
Please let me know if I introduced a mistake while resolving this merge or introduced something that you did not want.
Background
ActiveRecord#belongs_to accepts these args. ref
But , ActiveRecordExtensions drops
scope
arguments.https://github.com/active-hash/active_hash/blob/b11cb2e6151c6ac67d15d659fb2f2a931061bffa/lib/associations/associations.rb#L6-L21
Changes
In this PR, by calling super with no arguments, all arguments including scope are passed to super.