Ruby on rails 如何在数组中显示类属性
我的haml文件中有这个代码Ruby on rails 如何在数组中显示类属性,ruby-on-rails,haml,Ruby On Rails,Haml,我的haml文件中有这个代码 = f.select :rate_type, options_for_select(@rate_type, @selected_rate_type), required: true, :style => 'width:125px' 但是我想 def new @payer_contract = PayerContract.new( id: '', description: '', ty
= f.select :rate_type, options_for_select(@rate_type, @selected_rate_type), required: true, :style => 'width:125px'
但是我想
def new
@payer_contract = PayerContract.new(
id: '',
description: '',
type_code: {
id: '',
code_key: '',
display: '',
code_group: ''
},
base_contract_rate: '',
phase_dates: [{
id: '',
rate_type: '',
institutional: '',
professional: ''
}],
donor_claim_phase: '',
stoploss_amount: '',
stoploss_reimbursement_percentage: '',
begin_date: '',
end_date: '',
timely_filing_days: '',
payer: '',
rate_type: ''
)
选择阶段日期[费率类型],而不仅仅是费率类型。我试过这么做
= f.select :@phase_date.rate_type, options_for_select(@rate_type, @selected_rate_type), required: true, :style => 'width:125px'
但它不起作用。你知道这是什么语法吗?这样做:
= f.select :rate_type, options_for_select(@rate_type, @selected_rate_type), { required: true }, { :style => 'width:125px' }
更多信息,请参阅