Skip to content
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

Allow strong params in ActiveRecord::Base#exists? #34891

Merged
merged 2 commits into from
Jan 14, 2019

Conversation

gmcgibbon
Copy link
Member

Summary

Fixes #34752.

Allows ActionController::Params as argument of ActiveRecord::Base#exists?. This works already for #create and #where, so I think this change makes sense.

@@ -224,6 +225,14 @@ def test_exists_with_string
assert_equal true, Subscriber.exists?(" ")
end

def test_exists_with_strong_parameters
assert_equal false, Subscriber.exists?(nick: "foo")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am I missing something or this test is not using Parameters?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦‍♂️ My bad, fixed now.

Allow `ActionController::Params` as argument of
`ActiveRecord::Base#exists?`
@kaspth
Copy link
Contributor

kaspth commented Jan 7, 2019

I thought we had deprecated exists? without arguments?

@rafaelfranca
Copy link
Member

I thought we had deprecated exists? without arguments?

Not that I'm aware. Why would we do that?

@kaspth
Copy link
Contributor

kaspth commented Jan 8, 2019

I can't for the life of me find that discussion now via GitHub's search. I just seem to remember @matthewd and either @eugeneius and @kamipo talking about this.

@rafaelfranca rafaelfranca merged commit fcd38cf into rails:master Jan 14, 2019
@gmcgibbon gmcgibbon deleted the ac_params_exists branch January 14, 2019 22:35
bogdanvlviv added a commit to bogdanvlviv/rails that referenced this pull request Jan 17, 2019
suketa added a commit to suketa/rails_sandbox that referenced this pull request Jul 13, 2019
Allow strong params in ActiveRecord::Base#exists?
rails/rails#34891
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants