How do you pass of values using link_to? Here is what I am trying:
<%= link_to “Comment On This Article”, :action => “comment”, :article =>
And then on the next page I am trying to grab the :article value with:
<%= hidden_field_tag :article, params[:article] %>
Except that params[:article] is empty, telling me it didn’t pass it off.
How can I fix this? Thanks.
Josh G. wrote:
Except that params[:article] is empty, telling me
it didn’t pass it off.
Params are the mechanism for passing values from a rendered page back to
controller. Those values can then be used in the controller to do
including using them in the construction / rendering of another page.
that, you pass the value to the View in the form of an instance
Params: view --> controller. Instance variables: controller --> view.
in your case you’d need to do…
@article = params[:article]