StateTransitions
Short description and motivation.
Usage
How to use my plugin.
Installation
Add this line to your application's Gemfile:
gem "state_transitions"
And then execute:
bundle
Install migrations:
rails state_transitions:install:migrations
Run migrations:
rails db:migrate
Include the module in a model:
class Project < ApplicationRecord
include StateTransitions
end
Track current user on state transitions from requests:
class ApplicationController
around_action :set_state_transitions_current
private
def set_state_transitions_current
StateTransitions::Current.user = current_user
yield
ensure
StateTransitions::Current.user = nil
end
end
Contributing
Contribution directions go here.
License
The gem is available as open source under the terms of the MIT License.