diff options
author | Subba Rao Pasupuleti <subbarao.pasupuleti@gmail.com> | 2010-08-03 17:04:41 -0400 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-08-12 13:12:26 -0300 |
commit | ef0da581e94be1c938202cfa7ed39fb29614e570 (patch) | |
tree | 6e9686d405a549d7b1bf1152b91e8d28fa0bbdfe /activemodel/lib | |
parent | e82b38cd578aa316a03dae55df8076c4b2111bb6 (diff) | |
download | rails-ef0da581e94be1c938202cfa7ed39fb29614e570.tar.gz rails-ef0da581e94be1c938202cfa7ed39fb29614e570.tar.bz2 rails-ef0da581e94be1c938202cfa7ed39fb29614e570.zip |
no callbacks should be created for empty array [#5289 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activemodel/lib')
-rw-r--r-- | activemodel/lib/active_model/callbacks.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/activemodel/lib/active_model/callbacks.rb b/activemodel/lib/active_model/callbacks.rb index 8c10c54b54..b150fc60f7 100644 --- a/activemodel/lib/active_model/callbacks.rb +++ b/activemodel/lib/active_model/callbacks.rb @@ -90,10 +90,13 @@ module ActiveModel # def define_model_callbacks(*callbacks) options = callbacks.extract_options! - options = { :terminator => "result == false", :scope => [:kind, :name] }.merge(options) + options = { + :terminator => "result == false", + :scope => [:kind, :name], + :only => [:before, :around, :after] + }.merge(options) - types = Array.wrap(options.delete(:only)) - types = [:before, :around, :after] if types.empty? + types = Array.wrap(options.delete(:only)) callbacks.each do |callback| define_callbacks(callback, options) |