Created
August 12, 2010 20:31
-
-
Save graybill/521670 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
include Newflow | |
define_workflow do | |
state :draft, :start => true do | |
transitions_to :published, :if => lambda { true } | |
end | |
state :published do | |
transitions_to :unpublished , :if => lambda { true } | |
end | |
state :unpublished, :stop => true | |
end | |
///// | |
>> l = Link.new | |
=> #<Link id: nil, title: nil, description: nil, url: nil, created_at: nil, updated_at: nil, photo_file_name: nil, photo_content_type: nil, photo_file_size: nil, photo_updated_at: nil, popular: nil, featured: nil, workflow_state: "draft"> | |
>> l.transition! | |
=> :unpublished | |
>> l.current_state = 'draft' | |
=> "draft" | |
>> l.transition! | |
=> :unpublished | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment