I think routes are messing up data that I am trying to pass between showing a product and entering a review.
In the product/show view I have:
<%= link_to ‘Add a Review’, new_review_path, :xyz => @product.id %>
Inspecting the params of review/new there is nothing but {“action”=>“new”, “controller”=>“reviews”}
<%= link_to ‘Add a Review’, new_review_path(@product, :xyz => @product.id) %>
Phlip
(Phlip)
3
bala kishore pulicherla wrote:
<%= link_to 'Add a Review', new_review_path(@product, :xyz => @product.id) %>
I can't see the routes.rb, but ain't that just
new_review_path(@product.id)
?
Thanks, I got it to work with the following:
In the view sending the params information:
<%= link_to ‘Add a Review’, new_review_path(:product => @product.id)%>
In the view receiving the params information and passing it to the controller.
<%= f.hidden_field :product_id, :value => params[:product]%>
opz i forgot to post some thing
in routes.rb
map.resources :products.each do |product|
product.resource :reviews
end
and in the view
<%= link_to ‘Add a Review’, new_product_reviews_path(@product,:product_d => @product.id)%>
