Skip to content

Callback on entering initial state #233

@penguoir

Description

@penguoir

I'd like to run a callback when an object enters its initial state. For example:

class Article
  include Workflow

  workflow do
    state :new
  end

  def on_new_entry
    puts 'entered new'
  end
end

Currently, workflow doesn't run the on_new_entry callback. Is this expected? If so, what's the best practice for running a callback on entering of an initial state?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions