diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2008-11-22 18:37:08 -0800 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2008-11-22 19:19:13 -0800 |
commit | 0e2d18e415118afed2df148e5d7302ef0361b569 (patch) | |
tree | badfc2005f1b57f37b64efb6be51affab0cf04a6 /activemodel/lib/active_model/state_machine/state.rb | |
parent | 0492759db338a01623672674408a0bed62951ac6 (diff) | |
download | rails-0e2d18e415118afed2df148e5d7302ef0361b569.tar.gz rails-0e2d18e415118afed2df148e5d7302ef0361b569.tar.bz2 rails-0e2d18e415118afed2df148e5d7302ef0361b569.zip |
Extract state query method definition and quiet method redefinition warning.
Diffstat (limited to 'activemodel/lib/active_model/state_machine/state.rb')
-rw-r--r-- | activemodel/lib/active_model/state_machine/state.rb | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/activemodel/lib/active_model/state_machine/state.rb b/activemodel/lib/active_model/state_machine/state.rb index 68eb2aa34a..76916b1d86 100644 --- a/activemodel/lib/active_model/state_machine/state.rb +++ b/activemodel/lib/active_model/state_machine/state.rb @@ -5,11 +5,8 @@ module ActiveModel def initialize(name, options = {}) @name = name - machine = options.delete(:machine) - if machine - machine.klass.send(:define_method, "#{name}?") do - current_state.to_s == name.to_s - end + if machine = options.delete(:machine) + machine.klass.define_state_query_method(name) end update(options) end |