Sorry for noob question, I'm just trying RoR, but I have an issue with passing to strong params (I guess) nested resources items.
controller:
def update
if @product.update(product_params)
redirect_to @product, notice: "product has been updated"
end
end
models:
class Image < ActiveRecord::Base
belongs_to :products
end
class Product < ActiveRecord::Base
has_one :image, dependent: :destroy
accepts_nested_attributes_for :image
end
view:
= p.fields_for :image do |img|
= img.text_field :path
params:
"image_attributes"=>{"path"=>"1.jpg", "id"=>"13"},
"category_id"=>"2"}
As result only image path not updating...
Please give me solution. Thank You!