views:

41

answers:

1

Hello,

I am using this http://github.com/professionalnerd/simple-private-messages plugin in rails and I am on a user page show.html.erb - User and I want to put a button there that, when clicked, goes to the current user's inbox and populates the field call "send to" with the "user" name.

How do I send that data along when the button is clicked?

<%= link_to image_tag('send_message_button.jpg', :title => 'send #{user} a message', :alt => 'send #{user} a message'), new_user_message_path(current_user), :class=>'messageuser' %>

This goes to the current_user's inbox. I want to send the "params[:user_id]" variable along with it so that I can then fill out the "send to" textbox in the inbox page with it. How do I send that params variable along with this button?

+1  A: 

Use Following

<%= link_to image_tag('send_message_button.jpg', 
     :title => 'send #{user} a message',
     :alt => 'send #{user} a message'),
     {:controller=>controller_name, :action=>action_name, :id=>your_id, :user_id=>params[:user_id]},  
     :class=>'messageuser' %>
Salil