这是我的主要改革表格对象;
class CardHolderSupplierForm < ApplicationForm
property :supplier_id, validates: { presence: true }
property :standing_order, form: StandingOrderForm
end
而 StandingOrderForm 是;
class StandingOrderForm < ApplicationForm
property :amount_pence
property :reference
property :frequency
end
我在standing_orders 中有一个名为的列,该列amount_currency
应始终为“GBP”。我似乎无法让改革为我推这个。我尝试了各种方法;
class StandingOrderForm < ApplicationForm
property :amount_pence
property :reference
property :frequency
# does nothing
def amount_currency
"GBP"
end
# does nothing - can't even binding.pry
def save
model.amount_currency = "GBP"
super
end
我不知道如何让这个工作。表格的其余部分正常工作。