aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel
diff options
context:
space:
mode:
authorRoque Pinel <repinel@gmail.com>2015-06-21 19:56:53 -0400
committerRoque Pinel <repinel@gmail.com>2015-06-21 19:56:53 -0400
commitbfd4e6a0bc70e54d768b89c4ae8000cf50a87ec3 (patch)
tree7aa34c06247bf669a17e8f6c1e12407bf0699db0 /activemodel
parentf6797a7683e5367046217fa85900f0288a504f84 (diff)
downloadrails-bfd4e6a0bc70e54d768b89c4ae8000cf50a87ec3.tar.gz
rails-bfd4e6a0bc70e54d768b89c4ae8000cf50a87ec3.tar.bz2
rails-bfd4e6a0bc70e54d768b89c4ae8000cf50a87ec3.zip
Move the validations HelperMethods to its own file
Closes #11209 [Roque Pinel & Steven Yang]
Diffstat (limited to 'activemodel')
-rw-r--r--activemodel/lib/active_model/validations/helper_methods.rb13
-rw-r--r--activemodel/lib/active_model/validations/with.rb10
2 files changed, 13 insertions, 10 deletions
diff --git a/activemodel/lib/active_model/validations/helper_methods.rb b/activemodel/lib/active_model/validations/helper_methods.rb
new file mode 100644
index 0000000000..5a22b699d8
--- /dev/null
+++ b/activemodel/lib/active_model/validations/helper_methods.rb
@@ -0,0 +1,13 @@
+module ActiveModel
+ module Validations
+ module HelperMethods
+ private
+ def _merge_attributes(attr_names)
+ options = attr_names.extract_options!.symbolize_keys
+ attr_names.flatten!
+ options[:attributes] = attr_names
+ options
+ end
+ end
+ end
+end
diff --git a/activemodel/lib/active_model/validations/with.rb b/activemodel/lib/active_model/validations/with.rb
index a2531327bf..6de01b3392 100644
--- a/activemodel/lib/active_model/validations/with.rb
+++ b/activemodel/lib/active_model/validations/with.rb
@@ -1,15 +1,5 @@
module ActiveModel
module Validations
- module HelperMethods
- private
- def _merge_attributes(attr_names)
- options = attr_names.extract_options!.symbolize_keys
- attr_names.flatten!
- options[:attributes] = attr_names
- options
- end
- end
-
class WithValidator < EachValidator # :nodoc:
def validate_each(record, attr, val)
method_name = options[:with]