Class: AasmActionable::StateAction

Inherits:
Object
  • Object
show all
Defined in:
lib/aasm_actionable/controller_mixin.rb

Overview

A StateAction groups together the various attributes for an action being rendered, such as it’s title, HTML ID, and the name of the partial to render.

Note that the HTML ID is not unique, so it is not currently possible to call render_state_actions multiple times for the same taskable type on one page.

Author:

  • Brendan MacDonell

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event, action_view_prefix) ⇒ StateAction



14
15
16
17
18
# File 'lib/aasm_actionable/controller_mixin.rb', line 14

def initialize(event, action_view_prefix)
  @title = event.to_s.titleize
  @id = "action-#{event}"
  @partial = "#{action_view_prefix}/#{event}"
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



12
13
14
# File 'lib/aasm_actionable/controller_mixin.rb', line 12

def id
  @id
end

#partialObject (readonly)

Returns the value of attribute partial.



12
13
14
# File 'lib/aasm_actionable/controller_mixin.rb', line 12

def partial
  @partial
end

#titleObject (readonly)

Returns the value of attribute title.



12
13
14
# File 'lib/aasm_actionable/controller_mixin.rb', line 12

def title
  @title
end