小编Mik*_*kie的帖子

Rails 4中的ActiveRecord :: AssociationTypeMismatch

我已经嵌套在我的表格属性和2款 - 艺术品和ArtDescription,其连接HAS_ONE/belongs_to的,但我有错误

ArtworksController中的ActiveRecord :: AssociationTypeMismatch#创建ArtDescription(#30842620),获得ActionController :: Parameters(#9409680)

怎么了?

形成

  <%= form_for :artwork, url: artworks_path do |f| %>
    <p>
        name:<%= f.text_field :name %></br>
        author:<%= f.text_field :author %></br>
        date:<%= f.text_field :date %></br>
        museum:<%= f.text_field :museum %></br>
        place:<%= f.text_field :create_place %></br>
        comment:<%= f.text_field :comment %></br>
    </p>
    <p>
    <%= f.fields_for :art_description do  |artdesc|%>
        type:<%=  artdesc.text_field  :type  %></br>
        base:<%=  artdesc.text_field  :base  %></br>
        style:<%=  artdesc.text_field  :style  %></br>
        genre:<%=  artdesc.text_field  :genre  %></br>
        plot:<%=  artdesc.text_field  :plot  %></br>
        reference: <%=  artdesc.text_field  :reference  %></br>
        format_weight: <%=  artdesc.text_field  :format_weight%></br>
        format_height:<%= …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails-4

2
推荐指数
1
解决办法
3128
查看次数

标签 统计

ruby-on-rails-4 ×1