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

@gmcgibbon gmcgibbon commented Jan 7, 2019

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

@rafaelfranca rafaelfranca Jan 7, 2019

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

Copy link
Member Author

@gmcgibbon gmcgibbon Jan 7, 2019

🤦‍♂️ My bad, fixed now.

Allow `ActionController::Params` as argument of
`ActiveRecord::Base#exists?`
@gmcgibbon gmcgibbon force-pushed the ac_params_exists branch from 299cec8 to 1e923b4 Jan 7, 2019
@kaspth
Copy link
Member

@kaspth kaspth commented Jan 7, 2019

I thought we had deprecated exists? without arguments?

@rafaelfranca
Copy link
Member

@rafaelfranca rafaelfranca commented Jan 7, 2019

I thought we had deprecated exists? without arguments?

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

@kaspth
Copy link
Member

@kaspth 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
2 checks passed
@gmcgibbon gmcgibbon deleted the ac_params_exists branch Jan 14, 2019
bogdanvlviv added a commit to bogdanvlviv/rails that referenced this issue Jan 17, 2019
suketa added a commit to suketa/rails_sandbox that referenced this issue 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
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants