>
> Is it possible to pass parameters through link_to that will be used by
> the controller that link_to directs to? Specifically I have this
> code:
> <% for user in @users -%>
> <%= link_to user.screen_name, {:action => "index", :controller =>
> "users", :user_id => user.id } %>
> <% end %>
>
> Is it possible to use the parameter at the end of link_to(:user_id =>
> user.id) to initialize a hash @user using the user_id?
>
> This is the index action in the users controller:
> def index
> @user = User.find(:all, :conditions => { :id => :user_id })
> end
Either i'm horribly confused or you just need to do params[:user_id].
Typically though you'd just do
<%= link_to user.screen_name, {:action => "index", :controller =>
"users", :id => user.id }
and access it via params[:id]
Fred