ruby on rails - How to use variable from link -
i have link reads
<a href="<%= user_collections_path(@user, :status => "got") %>">collection</a>
and reads
<a href="<%= user_collections_path(@user, :status => "want") %>">wantlist</a>
they link same view produce different lists. on view page want able alter text depending on if collection or wantlist page. this:
<% if :status == 'got' %>collection<% elsif :status == 'want' %>wantlist<% end %>
obviously doesn't work after experimentation can't work out how query status passed in link. possible?
you should doing this
<% if params[:status] == 'got' %>collection <% elsif params[:status] == 'want' %>wantlist <% end %>
Comments
Post a Comment