Passing params - routes

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”}

Then again, I could be way off in the original link_to statement.

The code is pretty much stock stuff.

Any ideas?

<%= link_to ‘Add a Review’, new_review_path(@product, :xyz =>
@product.id)
%>

On Sun, Mar 30, 2008 at 8:09 AM, Sunny B. [email protected]

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)

?


Phlip

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]%>

On Sat, Mar 29, 2008 at 10:46 PM, bala kishore pulicherla <

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)%>

:slight_smile:

On Sun, Mar 30, 2008 at 8:45 AM, Sunny B. [email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs