-
Notifications
You must be signed in to change notification settings - Fork 21.8k
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
Removed where_values_hash from AR::NullRelation #11496
Removed where_values_hash from AR::NullRelation #11496
Conversation
/cc @senny, @rafaelfranca, @jonleighton |
👍 Nice work, thank you! |
Thanks to @beerlington and @Nthalk for their tests and CHANGELOG |
@rafaelfranca may you check this one, thanks in advance. |
Could someone please merge this, it seems to resolve more than one bug report. |
Run into the same issue today with Rails 4. Is it gonna be merged for 4.1.0 ? |
+1 |
In order to build associated records for owners which has not been saved need to get where values to use as default attributes. But for new record owner uses `ActiveRecord::NullRelation` which override `where_values_hash` to return empty hash stub. `where_values_hash` is not used to invoke any sql query, but good to build others chains (even will be never executed) like: ```ruby post = Post.new admin_comment = post.admin_comments.build assert_equal 'Admin', admin_comment.author ``` Closes rails#11376, rails#11676, rails#11675
Rebased! |
…ct_scope_on_build Removed where_values_hash from AR::NullRelation
Merged. Sorry for the delay guys |
…ct_scope_on_build Removed where_values_hash from AR::NullRelation Conflicts: activerecord/CHANGELOG.md
Thanks... Any plans for a 4.0.1 release? |
Thanks @rafaelfranca! 👍 |
@jarl-dk : Yes, the pull request has been backported to the |
@jarl-dk : Most of the time, the issues are put under a "milestone" on this tracker. As you can see, this is under the 4.0.1 milestone so this should be. :-) |
In order to build associated records for owners which has not been saved
need to get where values to use as default attributes.
But for new record owner uses
ActiveRecord::NullRelation
whichoverride
where_values_hash
to return empty hash stub.where_values_hash
is not used to invoke any sql query, but good tobuild others chains (even will be never executed) like:
Closes #11376, #11676 and #11675