diff options
Diffstat (limited to 'activemodel/lib')
5 files changed, 8 insertions, 8 deletions
diff --git a/activemodel/lib/active_model/state_machine/event.rb b/activemodel/lib/active_model/state_machine/event.rb index e8bc8ebdb7..8acde7fd47 100644 --- a/activemodel/lib/active_model/state_machine/event.rb +++ b/activemodel/lib/active_model/state_machine/event.rb @@ -2,15 +2,15 @@ module ActiveModel module StateMachine class Event attr_reader :name, :success - + def initialize(machine, name, options = {}, &block) @machine, @name, @transitions = machine, name, [] if machine - machine.klass.send(:define_method, "#{name.to_s}!") do |*args| + machine.klass.send(:define_method, "#{name}!") do |*args| machine.fire_event(name, self, true, *args) end - machine.klass.send(:define_method, "#{name.to_s}") do |*args| + machine.klass.send(:define_method, name.to_s) do |*args| machine.fire_event(name, self, false, *args) end end diff --git a/activemodel/lib/active_model/validations.rb b/activemodel/lib/active_model/validations.rb index 7efe9901ca..460d2d82e5 100644 --- a/activemodel/lib/active_model/validations.rb +++ b/activemodel/lib/active_model/validations.rb @@ -4,7 +4,7 @@ module ActiveModel module Validations def self.included(base) # :nodoc: base.extend(ClassMethods) - base.send!(:include, ActiveSupport::Callbacks) + base.__send__(:include, ActiveSupport::Callbacks) base.define_callbacks :validate, :validate_on_create, :validate_on_update end diff --git a/activemodel/lib/active_model/validations/exclusion.rb b/activemodel/lib/active_model/validations/exclusion.rb index f3367abcf8..1592000fc7 100644 --- a/activemodel/lib/active_model/validations/exclusion.rb +++ b/activemodel/lib/active_model/validations/exclusion.rb @@ -26,7 +26,7 @@ module ActiveModel enum = configuration[:in] || configuration[:within] - raise(ArgumentError, "An object with the method include? is required must be supplied as the :in option of the configuration hash") unless enum.respond_to?("include?") + raise(ArgumentError, "An object with the method include? is required must be supplied as the :in option of the configuration hash") unless enum.respond_to?(:include?) validates_each(attr_names, configuration) do |record, attr_name, value| record.errors.add(attr_name, configuration[:message] % value) if enum.include?(value) diff --git a/activemodel/lib/active_model/validations/inclusion.rb b/activemodel/lib/active_model/validations/inclusion.rb index 9fc1caaabe..9b4cb64307 100644 --- a/activemodel/lib/active_model/validations/inclusion.rb +++ b/activemodel/lib/active_model/validations/inclusion.rb @@ -26,7 +26,7 @@ module ActiveModel enum = configuration[:in] || configuration[:within] - raise(ArgumentError, "An object with the method include? is required must be supplied as the :in option of the configuration hash") unless enum.respond_to?("include?") + raise(ArgumentError, "An object with the method include? is required must be supplied as the :in option of the configuration hash") unless enum.respond_to?(:include?) validates_each(attr_names, configuration) do |record, attr_name, value| record.errors.add(attr_name, configuration[:message] % value) unless enum.include?(value) diff --git a/activemodel/lib/active_model/validations/uniqueness.rb b/activemodel/lib/active_model/validations/uniqueness.rb index 68cd6169e5..593d2cfd54 100644 --- a/activemodel/lib/active_model/validations/uniqueness.rb +++ b/activemodel/lib/active_model/validations/uniqueness.rb @@ -79,8 +79,8 @@ module ActiveModel results = finder_class.with_exclusive_scope do connection.select_all( construct_finder_sql( - :select => "#{attr_name}", - :from => "#{finder_class.quoted_table_name}", + :select => attr_name, + :from => finder_class.quoted_table_name, :conditions => [condition_sql, *condition_params] ) ) |