Reputation: 12187
Apologies if this seems a bit vague.
Basically I have a page which loads content based on id. I'm trying to put links withing it like this
<%= link_to 'mypage', {:action => 'mypageload', :id => '1'},{:class=>'mypages'}%>
What I'd like to do is pass the id of the current page into this link.
So something like
:id => 'params[:id]'
Is there a way to do this?
Upvotes: 0
Views: 1904
Reputation: 21180
Yes, you can use the params variable in the views. In your example you put the params inside quotes making it a string. Just leave those out and you should be fine, like this:
<%= link_to 'mypage', {:action => 'mypageload', :id => params[:id]},{:class=>'mypages'}%>
Upvotes: 1