我的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: '',
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: ''
)
选择phase_dates [rate_type],而不仅仅是rate_type。我试过这样做,
= f.select :@phase_date.rate_type, options_for_select(@rate_type, @selected_rate_type), required: true, :style => 'width:125px'
但它不起作用。知道这个的语法是什么?
答案 0 :(得分:0)
这样做:
= f.select :rate_type, options_for_select(@rate_type, @selected_rate_type), { required: true }, { :style => 'width:125px' }
请查看select documentation以获取更多信息。