Module: Etat::ActiveRecord::ClassMethods
- Defined in:
- lib/etat/active_record.rb
Instance Method Summary collapse
Instance Method Details
#event(event_name, &block) ⇒ Object
27 28 29 30 31 |
# File 'lib/etat/active_record.rb', line 27 def event event_name, &block define_method(event_name) do instance_eval &block end end |
#has_states(*states) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/etat/active_record.rb', line 14 def has_states *states @states = [] states.each do |state| if state.is_a?(Symbol) create_state_with state create_scopes state @states << state else raise 'States should be symbol' end end end |
#states ⇒ Object
33 34 35 |
# File 'lib/etat/active_record.rb', line 33 def states @states end |