0
我有這樣的模式:軌道嵌套形式混亂
class Employment < ActiveRecord::Base
accepts_nested_attributes_for :month_lines
end
並有形成:
employment.new
= form_for @employment do |f|
= f.fields_for :month_lines do |builder|
= render "/month_lines/fields", :f => builder
month_lines/_fields
= f.number_field :days
我想在partial中顯示month_line.year
如何從_fields部分中訪問month_line對象?
由於本地:f是建設者,那麼爲什麼不'f.number_field:在_fields year'工作的部分? – mill
我需要顯示年份的值,而不是字段。感謝您的評論 – Gady