31 Mar '16, 5am

“Railsで可読性の高いステート・マシンを実現できるGem state_machine - 酒と泪とRubyとRailsと” https://t.co/hYd0ITkwie

class Human < ActiveRecord :: Base state_machine :runner_state , :initial => :stand do state :stand state :walk state :run event :change_pace do transition :to => :walk , :from => [ :stand ] transition :to => :run , :from => [ :walk ] transition :to => :stand , :from => [ :run ]

Full article: http://morizyun.github.io/blog/state_machine-gem-ruby-rails/

Tweets