ruby-on-railsruby-on-rails-3routesapplicationcontroller

How do you route an action to the application controller in Rails 3?


I am using the gem rails3-jquery-autocomplete and had no problems with it, however I have now moved my autocomplete form into the application template and therefore the ajax calls are now being dealt by the application controller, so my routes have changed from:

home/autocomplete_category_name

and now need to have the home removed and the path from:

home_autocomplete_category_name_path

to:

autocomplete_category_name_path

Anybody got any ideas? Still learning the ins and outs of Rails so this is a dead end for me right now.

Thanks.


Solution

  • URLs don't map directly to ApplicationController - only subclasses of it.

    You need to move the call to autocomplete into another controller. The location of the form shouldn't make a difference, as long as you're passing the correct path when you define your text_field