2011-01-12 28 views
2

在我的Rails 2.3的应用程序,以下路线进行正常工作阿贾克斯航线的Rails 3

map.ajax 'ajax', :controller => 'widgetresponse_controller' , :action => 'getWidgetJson' 

当我迁移到Rails 3,
我尝试了一些新的航线,得到这个工作,但没有他们工作。

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' 

这是一个非常基本的问题,但我不知道我做错了什么。

+0

您是否收到错误? – polarblau 2011-01-12 17:57:48

+0

为什么你的控制器看起来像:你的Rails 2.x路由中的widgetresponse_controller? – apneadiving 2011-01-12 18:31:14

+0

@polarblau:是的,它没有找到路由和显示:路由错误 没有路由匹配“/ widgetresponse/getWidgetJson/1” – 2011-01-12 18:34:20

回答

1

你可以试试这个:

可能已经发生过
match "/widgetresponse/getWidgetJson/:id" => "widgetresponse#getWidgetJson"