i have this problem. I have the edit view that updates a product and here my action in product_controller
def edit_product
@product = Product.find(params[:product][:id])
respond_to do |format|
if @product.update_attributes(params[:product])
format.html { render action: "edit_product" }
else
format.html { render action: "edit" }
format.json { render json: @product.errors, status: :unprocessable_entity }
end
end
end
The problem is that when i call for edit view i pass the id_product while now i can't in the render action and it gives error
How to solve it and render something like edit?id_product= ??
this is my products resources
resources :products, :only => [:index] do
collection do
post 'new_product'
post 'edit_product'
end
end