app/models/state_machines/page.rb in voluntary-0.2.4 vs app/models/state_machines/page.rb in voluntary-0.3.0
- old
+ new
@@ -6,10 +6,18 @@
attr_accessor :current_user
const_set 'STATES', [:active]
const_set 'EVENTS', []
+ after_initialize :set_initial_state
+
state_machine :state, initial: :active do
+ end
+
+ private
+
+ def set_initial_state
+ self.state ||= :active
end
end
end
module ClassMethods
\ No newline at end of file