我正在尝试在生产信息页面中创建新的石油生产。田地正在出现,但我无法获得石油生产。任何帮助表示赞赏
Productioninfos_controller.rb
def index
@productioninfos = Productioninfo.all
end
def new
@productioninfo = Productioninfo.new
end
def productioninfo_params
params.require(:productioninfo).permit(:firstproduction, :lastproduction, :numberofcompl, :totaldepth, :productionzone, oilproductioninfos_attributes: [:id, :oilcum, :avgbpmlastsixmonths, :avgbpodlastsixmonths])
end
Productioninfo.rb(model)
has_many :oilproductioninfos
accepts_nested_attributes_for :oilproductioninfo, :allow_destroy => :true, :reject_if => :blank
Oilproductioninfo.rb(model)
belongs_to :productioninfo
Productioninfos_form.html.erb
<%= f.fields_for :oilproductioninfos do |ff| %>
<div>
<%= ff.label :oilcum %>
<%= ff.text_field :oilcum %>
<%= ff.label :avgbpmlastsixmonths %>
<%= ff.text_field :avgbpmlastsixmonths %>
<%= ff.label :avgbpodlastsixmonths %>
<%= ff.text_field :avgbpodlastsixmonths %>
</div>