Class: OrderObserver
- Defined in:
- app/models/order_observer.rb
Instance Method Summary collapse
-
#after_transition(record, attribute_name, event_name, from_state, to_state) ⇒ Object
Generic transition callback after the transition is performed.
Instance Method Details
#after_transition(record, attribute_name, event_name, from_state, to_state) ⇒ Object
Generic transition callback after the transition is performed
5 6 7 8 9 10 11 12 13 14 |
# File 'app/models/order_observer.rb', line 5 def after_transition(record, attribute_name, event_name, from_state, to_state) current_user_session = UserSession.activated? ? UserSession.find : nil = current_user_session ? current_user_session.user : record.user record.state_events.create({ :previous_state => from_state, :name => event_name, :user_id => && .id }) ActiveRecord::Base.logger.info("Order##{record.id}: #{from_state} => #{to_state}") end |