Skip to content

Commit

Permalink
Uses Rails 3 "base.before_validation :aasm_ensure_initial_state, :on …
Browse files Browse the repository at this point in the history
…=> :create" method
  • Loading branch information
mattallen authored and ttilley committed Feb 10, 2010
1 parent c1b61c6 commit fb51ab4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/aasm/persistence/active_record_persistence.rb
Expand Up @@ -13,7 +13,7 @@ module ActiveRecordPersistence
#
# Adds
#
# before_validation_on_create :aasm_ensure_initial_state
# before_validation :aasm_ensure_initial_state, :on => :create
#
# As a result, it doesn't matter when you define your methods - the following 2 are equivalent
#
Expand Down Expand Up @@ -50,8 +50,7 @@ class << self
end
end
end

base.before_validation_on_create :aasm_ensure_initial_state
base.respond_to?(:before_validation_on_create) ? base.before_validation_on_create :aasm_ensure_initial_state : base.before_validation :aasm_ensure_initial_state, :on => :create
end

module ClassMethods
Expand Down

0 comments on commit fb51ab4

Please sign in to comment.