Reputation: 7015
In my Rails 2.3 application, the following routes were working properly
map.ajax 'ajax', :controller => 'widgetresponse_controller' , :action => 'getWidgetJson'
When I migrated to Rails 3,
I tried a number of new routes, to get this working but none of them worked.
1.
match 'ajax' => 'widgetresponse#getWidgetJson', :as => :ajax
2.
match 'ajax' => 'widgetresponse_controller#getWidgetJson', :as => :ajax
3.
get 'widgetresponse/getWidgetJson', :as => :ajax
4.
get 'widgetresponse/getWidgetJson'
Its a very basic question to ask, but I don't know what I am doing wrong.
Upvotes: 2
Views: 3249
Reputation: 96464
One thing that may have happened before is that things were falling through to the default route which was removed in Ruby on Rails 3 (good idea).
I found this guide:
http://www.engineyard.com/blog/2010/the-lowdown-on-routes-in-rails-3/
really helpful with lot of yummy new rails 3 options.
Upvotes: 1
Reputation: 17734
You could try this:
match "/widgetresponse/getWidgetJson/:id" => "widgetresponse#getWidgetJson"
Upvotes: 1