Module: MoneyAttribute::MigrationExtensions::TableDefinition
- Includes:
- Helper
- Defined in:
- lib/money_attribute/migration_extensions/table_definition.rb
Overview
Constant Summary
Constants included
from Helper
Helper::AMOUNT_CONFIG, Helper::CURRENCY_DEFAULT_LIMIT, Helper::CURRENCY_MIN_LIMIT
Instance Method Summary
collapse
Instance Method Details
#money_amount(accessor, options = {}) ⇒ Object
25
26
27
28
29
|
# File 'lib/money_attribute/migration_extensions/table_definition.rb', line 25
def money_amount(accessor, options = {})
amount_col, amount_opts = parse_money_amount_args(accessor, options)
column(amount_col, amount_opts[:type], **amount_opts.except(:type))
end
|
#money_attribute(accessor, options = {}) ⇒ Object
11
12
13
14
15
16
|
# File 'lib/money_attribute/migration_extensions/table_definition.rb', line 11
def money_attribute(accessor, options = {})
amount_col, currency_col, amount_opts, currency_opts = parse_money_args(accessor, options)
column(amount_col, amount_opts[:type], **amount_opts.except(:type))
column(currency_col, :string, **currency_opts)
end
|
#remove_money_amount(accessor, options = {}) ⇒ Object
31
32
33
34
35
|
# File 'lib/money_attribute/migration_extensions/table_definition.rb', line 31
def remove_money_amount(accessor, options = {})
amount_col, = parse_money_amount_args(accessor, options)
remove_column(amount_col)
end
|
#remove_money_attribute(accessor, options = {}) ⇒ Object
18
19
20
21
22
23
|
# File 'lib/money_attribute/migration_extensions/table_definition.rb', line 18
def remove_money_attribute(accessor, options = {})
amount_col, currency_col, = parse_money_args(accessor, options)
remove_column(amount_col)
remove_column(currency_col)
end
|