Form nested parameters issue

Hello everyone. I’m doing something similar to the AJAX based search
facility presented the Friends of ED book, but it doesn’t work for
non-javascript browsers, so I’m trying to improve it.

The search engine looks like:
<% form_remote_tag :url => { :action => :search } do %> #For non AJAX
Search: <%= text_field “product”, “search” %>
<%= submit_tag “Buscar” %>
<% end %>
<%= observe_field :product_title,
:frequency => 1.0,
:update => ‘products’,
:url => { :controller => ‘store’, :action=> ‘search’ },
:with => “‘search=’ + encodeURIComponent(value)” #AJAX

And this action checks if ‘search’ has something similar to any
product title in the DB:
def search
@products = Product.find(:all,:conditions => [“lower(title) like
?”,"%" + params[:search].downcase + “%”])

Searching for “traxxas” with JS enabled works, and it prints in
development.log the following:
Parameters: {“search”=>“traxxas”, “action”=>“search”,

With JS disabled development.log shows:
Parameters: {“commit”=>“Filter products”,
“product”=>{“search”=>“traxxas”}, “action”=>“search”,

So I can’t accede to “search”=>“traxxas”, which is inside product,
from the search action (params[:search].downcase gets nil.downcase).
How can I figure this out?

Thanks in advance;
Eugenio Costa.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs