Friday, May 7, 2010

Re: [Rails] strange routing error

Hi, can you post the whole routes.rb file content?

2010/5/8 badnaam <asitkmishra@gmail.com>
I am trying to populate a select element based on the selection change
in another select element, all this via ajax.

I created a custom action called getsubcat and added it to my
routes.rb

 map.resources :gcertsteps, :has_many => [:merchants], :collection =>
{:getsubcat => :get}

my getsubcat action is pretty simple, it just returns a hash, does not
even hit the db.  For some reason the ajax call is actually calling
the #show method not the getsubcat method and I get an error that
says..can't find <model_name> with id=subcat!!

Why is the show action being called when I am specifically calling the
getsubcat action?

<%= f.input :category_name, :as => :select, :collection =>
Gcertstep::CATEGORIES.keys %>
   <%= observe_field :gcertstep_category_name, :url => {:action =>
"getsubcat"}, :method => :get, :frequency => 0.5, :with =>
"'category_name=' + encodeURIComponent(value)" %>

Baffling..any ideas?

Thanks

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment