我正在尝试将时间选择与传递给局部的本地人一起使用,但出现以下错误
undefined method `open_time' for #<Merchant:0x007fb41fd0aa90>
部分通话
= form_for @merchant, :url => admin_merchant_path(@merchant) do |form|
#account-panel.mdl-tabs__panel
= render :partial => 'venue', :locals => {:address_fields => form}
= render :partial => 'hours', :locals => {:hour_fields => form}
部分渲染
.mdl-cell.mdl-cell--12-col
/h3.mdl-typography--display-1.teal-heading= t('.trading_hours_title')
- (0..6).each do |i|
li.mdl-list__item.mdl-list__item--two-line
span.mdl-list__item-primary-content
= Date::DAYNAMES[i]
span.mdl-list__item-sub-title
= hour_fields.time_select :open_time, {:minute_step => 30, :ampm => true}
商家模式
has_many :trading_hours, dependent: :destroy
accepts_nested_attributes_for :trading_hours
交易时间模型
belongs_to :merchant