title: send variable to controller with link_to method rails 3
body: <p>I have a problem with link_to to send variable. With form_for and submit button works fine, but I need send the data with link_to.</p>
  
  <p>This works fine with form_for:</p>
  
  <pre><code>&lt;%= form_for (@post), :method =&gt; :post,  :remote =&gt; true, :html =&gt; { :id =&gt; "#{@post.id}" }, :url =&gt; { :controller =&gt; "posts", :action =&gt; "follow", :post_id =&gt; post.id } do |f|  %&gt; 
  &lt;%= f.submit "Follow" %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>This not works :(:</p>
  
  <pre><code>&lt;%= link_to post_path(@post), :method =&gt; :post, :remote =&gt; true, :html =&gt; { :id =&gt; "#{@post.id}" }, :url =&gt; { :controller =&gt; "posts", :action =&gt; "follow", :post_id =&gt; post.id }  do%&gt; 
  &lt;em&gt;&lt;/em&gt;
  &lt;%= "Follow" %&gt;
  &lt;% end %&gt; 
  </code></pre>
  
  <p>This last, link_to not send params, and my controller not receive the params and get a error type <strong>InvalidFind (Calling Document#find with nil is invalid):</strong></p>
  
  <h2> Edited: </h2>
  
  <p><strong>I found now a solution...the params must be set into the target-
  parameter:</strong></p>
  
  <pre><code>&lt;%= link_to post_path(:post_id =&gt; post.id), :method =&gt; :post, :remote =&gt; true, :html =&gt; { :id =&gt; "#{@post.id}" }, :url =&gt; { :controller =&gt; "posts", :action =&gt; "follow" }  do%&gt; 
  </code></pre>