Created
November 22, 2016 11:28
-
-
Save pashagray/699d3f4df33ee62e62e0a1162e46b685 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# base_controller.rb | |
before_filter :set_current_user | |
def set_current_user | |
User.current_user = current_user | |
end | |
# user.rb | |
def self.current_user=(user) | |
Thread.current[:current_user] = user | |
end | |
def self.current_user | |
Thread.current[:current_user] | |
end | |
# order.rb | |
event :complete do | |
transitions from: :processing, to: :completed, | |
after: Proc.new { self.completed_at = Time.now.utc }, | |
on_transition: Proc.new { self.moved_to_completed_by = User.current_user } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment