1
0
Fork 0
mirror of https://github.com/aasm/aasm synced 2023-03-27 23:22:41 -04:00

fix deprecation warnings in rails3 (_without_ breaking rails2)

This commit is contained in:
Travis Tilley 2010-09-13 04:16:54 -04:00
parent 0600de0410
commit eced341dfa

View file

@ -50,7 +50,12 @@ module AASM
end
end
end
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)
if ActiveRecord::VERSION::MAJOR >= 3
base.before_validation(:aasm_ensure_initial_state, :on => :create)
else
base.before_validation_on_create(:aasm_ensure_initial_state)
end
end
module ClassMethods