Class: StateMonitor

Inherits:
ActiveRecord::Observer
  • Object
show all
Defined in:
app/models/state_monitor.rb

Instance Method Summary collapse

Instance Method Details

#after_transition(object, transition) ⇒ Object

Generic transition callback after the transition is performed



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/models/state_monitor.rb', line 5

def after_transition(object, transition)

  # current_user_session = Session.activated? ? Session.find : nil
  #
  # if current_user_session
  #   author = current_user_session.user
  # elsif object.respond_to?(:user)
  #   author = object.user
  # end
  #
  # to_state = transition.attributes[:to_name]
  # object.state_events.create({
  #   :previous_state => transition.attributes[:from],
  #   :name           => transition.attributes[:event].to_s,
  #   :user_id        => author && author.id
  #   })
  #
  # ActiveRecord::Base.logger.info("#{object.class}##{object.id}: #{transition.attributes[:from]} => #{transition.attributes[:to]}")
end