Module: AASM::Persistence::ActiveRecordPersistence::ClassMethods
- Defined in:
- lib/persistence/active_record_persistence.rb
Instance Method Summary collapse
-
#aasm_column(column_name = nil) ⇒ Object
Maps to the aasm_column in the database.
Instance Method Details
#aasm_column(column_name = nil) ⇒ Object
Maps to the aasm_column in the database. Deafults to “aasm_state”. You can write:
create_table :foos do |t|
t.string :name
t.string :aasm_state
end
class Foo < ActiveRecord::Base
include AASM
end
OR:
create_table :foos do |t|
t.string :name
t.string :status
end
class Foo < ActiveRecord::Base
include AASM
aasm_column :status
end
This method is both a getter and a setter
68 69 70 71 72 73 74 75 |
# File 'lib/persistence/active_record_persistence.rb', line 68 def aasm_column(column_name=nil) if column_name @aasm_column = column_name.to_sym else @aasm_column ||= :aasm_state end @aasm_column end |