mirror of
https://github.com/aasm/aasm
synced 2023-03-27 23:22:41 -04:00
circumventing a bug in Rails 3 #193
This commit is contained in:
parent
e48fcc1161
commit
6a990c3e05
1 changed files with 3 additions and 1 deletions
|
@ -164,7 +164,9 @@ module AASM
|
|||
# foo.aasm_state # => nil
|
||||
#
|
||||
def aasm_ensure_initial_state
|
||||
if respond_to?(self.class.aasm.attribute_name) && send(self.class.aasm.attribute_name).blank?
|
||||
# checking via respond_to? does not work in Rails <= 3
|
||||
# if respond_to?(self.class.aasm.attribute_name) && send(self.class.aasm.attribute_name).blank? # Rails 4
|
||||
if attributes.key?(self.class.aasm.attribute_name.to_s) && send(self.class.aasm.attribute_name).blank?
|
||||
aasm.enter_initial_state
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue