I'm running Rails 2.3.5 & Ruby 1.8.7 on Windows XP.
I have two partials:
1. File app\views\warehousing\_index.html.erb has
.....
<%= select_tag(:filter_by_category, "<option>-Select a category-
</option>" +
That means the string "Hello World" in variable filter_by_category is
indeed passed from one partial to the other. For my project, I want
to pass the selected option value from the select_tag to partial
_entry.html.erb, i.e. in file _entry.html.erb, for line
<%= render :partial => 'warehousing/entry', :locals =>
{:filter_by_category => ???} %>
what should I put in for "???".
I'm running Rails 2.3.5 & Ruby 1.8.7 on Windows XP.
Why on earth are you doing Rails development on Windows? At least get a
*nix VM.
I have two partials:
1. File app\views\warehousing\_index.html.erb has
.....
<%= select_tag(:filter_by_category, "<option>-Select a category-
</option>" +
That means the string "Hello World" in variable filter_by_category is
indeed passed from one partial to the other. For my project, I want
to pass the selected option value from the select_tag to partial
_entry.html.erb, i.e. in file _entry.html.erb, for line
<%= render :partial => 'warehousing/entry', :locals =>
{:filter_by_category => ???} %>
what should I put in for "???".
It's not possible, because at the time the partial is rendered, the user
has not yet had a chance to select anything -- that is, by the time the
user sees the page in the browser, _entry has already been rendered and
it is now too late to change it.
Therefore, you'd need to use Ajax to send a request to the server which
would re-render _entry when a new category is selected.