Ruby on Rails Saturday, November 2, 2019

The I'm getting error is
undefined method `item_property_id' for #<ItemItemProperty::ActiveRecord_Associations_CollectionProxy:0x007f82c41438d8>

  def new
        @item = Item.new(item_params)
        ItemProperty.where(item_type: params[:item][:item_type]).each do |ip|
            @item.item_item_properties.build(item_property_id: ip.id)
        end
  end


            <%= f.fields_for :item_item_properties do |iip| %>
                      <div class="item_item_property">
                          <%= iip.label "#{ItemProperty.find(@item.item_item_properties.item_property_id).name}" %>  <%= iip.hidden_field :item_property_id, value: @item.item_item_properties.item_property_id %> <%= iip.text_field  :text_value %>
                      </div>
            <% end %>

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/98eed4a3-d1dc-4a3e-a0af-058d0f10740b%40googlegroups.com.

No comments:

Post a Comment