diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2008-09-03 17:44:58 +0100 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2008-09-03 17:44:58 +0100 |
commit | 2933f4481f8b70b3b809fab6e818d80c2af1b919 (patch) | |
tree | c83d1308545cc82215b90ab37208cc81b4712276 /activemodel/lib | |
parent | 36ee17d458b86c5f3f371810160e8839d318bbf1 (diff) | |
parent | 10fe6a6d8940300dd6698ec38e9c9573404e687d (diff) | |
download | rails-2933f4481f8b70b3b809fab6e818d80c2af1b919.tar.gz rails-2933f4481f8b70b3b809fab6e818d80c2af1b919.tar.bz2 rails-2933f4481f8b70b3b809fab6e818d80c2af1b919.zip |
Merge commit 'mainstream/master'
Conflicts:
actionpack/lib/action_controller/resources.rb
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] ) ) |