Merge pull request #209 from facetostool/feature

change method to check attribute_name
This commit is contained in:
Thorsten Böttger 2015-02-14 22:00:32 +13:00
commit 123700ce4e
1 changed files with 1 additions and 1 deletions

View File

@ -166,7 +166,7 @@ module AASM
def aasm_ensure_initial_state
# 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?
if attribute_names.include?(self.class.aasm.attribute_name.to_s) && send(self.class.aasm.attribute_name).blank?
aasm.enter_initial_state
end
end