From bfd4e6a0bc70e54d768b89c4ae8000cf50a87ec3 Mon Sep 17 00:00:00 2001 From: Roque Pinel Date: Sun, 21 Jun 2015 19:56:53 -0400 Subject: Move the validations HelperMethods to its own file Closes #11209 [Roque Pinel & Steven Yang] --- activemodel/lib/active_model/validations/helper_methods.rb | 13 +++++++++++++ activemodel/lib/active_model/validations/with.rb | 10 ---------- 2 files changed, 13 insertions(+), 10 deletions(-) create mode 100644 activemodel/lib/active_model/validations/helper_methods.rb (limited to 'activemodel') 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] -- cgit v1.2.3