Ruby on Rails - Passing a large variable from view to controller (avoiding HTTP 414 Request-URI Too Large)
<p>I am attempting to pass a large Ruby hash (@hash) that is already available in my view back to my controller for additional processing.  The hash comes from the same controller but it will be processed by a different action.</p>

<p>There are several articles on Stack Overflow about passing a variable (hash or otherwise) from View to Controller using the params hash and they work nicely, however the resulting HTTP GET request is extremely long (in my case) and often a '414 Request-URI Too Large' error is thrown by Apache.</p>

<p>Here is the code I have in my view:</p>

<pre><code>&lt;%= link_to "Go to controller for processing", :controller =&gt; 'query', :action =&gt; 'parse_data', :hash_contents =&gt; @data %&gt;
</code></pre>

<p>Here is the code I am using in my controller to process @data:</p>

<pre><code>def parse_data
  # take action on :hash_contents which now contains @data
end
</code></pre>

<p>Perhaps I shouldn't be using link_to to handle this but I don't know of an alternative to get data back to my controller. I also heard chatter about using a HTTP POST instead of GET (as apparently you can pass along a hidden field) but I'm not certain how to implement that in this scenario.  Any help is greatly appreciated!</p>