aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2015-06-22 09:15:08 +0200
committerYves Senn <yves.senn@gmail.com>2015-06-22 09:15:08 +0200
commit73aa66342e685b21ece23192bcb0e79c069e962a (patch)
tree9fad7a330834809263d085d3be8392cbc00efda8 /activemodel/lib
parent8bf60b02b8501a5d33f6ae68a0077da2a92d310f (diff)
parentbfd4e6a0bc70e54d768b89c4ae8000cf50a87ec3 (diff)
downloadrails-73aa66342e685b21ece23192bcb0e79c069e962a.tar.gz
rails-73aa66342e685b21ece23192bcb0e79c069e962a.tar.bz2
rails-73aa66342e685b21ece23192bcb0e79c069e962a.zip
Merge pull request #20656 from repinel/move-validations-helper-methods
Move the validations HelperMethods to its own file
Diffstat (limited to 'activemodel/lib')
-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]