aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/support
diff options
context:
space:
mode:
authorGannon McGibbon <gannon.mcgibbon@gmail.com>2019-01-07 14:05:50 -0500
committerGannon McGibbon <gannon.mcgibbon@gmail.com>2019-01-07 14:59:02 -0500
commit1e923b498492424ae627d7a2c61339148f887503 (patch)
treefbf12561c3ed87e714d5dd4b217c5d5ffd55eea6 /activerecord/test/support
parent9cfcc067e626f0f1e220cc00a9f96622a936350d (diff)
downloadrails-1e923b498492424ae627d7a2c61339148f887503.tar.gz
rails-1e923b498492424ae627d7a2c61339148f887503.tar.bz2
rails-1e923b498492424ae627d7a2c61339148f887503.zip
Allow strong params in ActiveRecord::Base#exists?
Allow `ActionController::Params` as argument of `ActiveRecord::Base#exists?`
Diffstat (limited to 'activerecord/test/support')
-rw-r--r--activerecord/test/support/stubs/strong_parameters.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/activerecord/test/support/stubs/strong_parameters.rb b/activerecord/test/support/stubs/strong_parameters.rb
new file mode 100644
index 0000000000..acba3a4504
--- /dev/null
+++ b/activerecord/test/support/stubs/strong_parameters.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class Parameters
+ def initialize(parameters = {})
+ @parameters = parameters.with_indifferent_access
+ end
+
+ def permitted?
+ true
+ end
+
+ def to_h
+ @parameters.to_h
+ end
+end