浏览 609 次
|
精华帖 (0) :: 良好帖 (0) :: 新手帖 (2) :: 隐藏帖 (0)
|
|
|---|---|
| 作者 | 正文 |
|
时间:2008-04-04 关键字: 路由, 错误, connect
注释掉这两句后
#map.connect ':controller/:action/:id' #map.connect ':controller/:action/:id.:format' 这个语句报错! <%=form.select(:id, @class, {:prompt => "请选择"}, { "onchange" => remote_function( :with => "'parent_id='+value", :update => 'next_select', :url => {:action => "select_with_class"} ) })%> 错误提示: No route matches {:action=>"select_with_class"} 不知如何解决。 声明:JavaEye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
|
|
| 返回顶楼 | |
|
时间:2008-04-04
为什么你非要注释呢?解决办法就是自己取消注释。
|
|
| 返回顶楼 | |
|
时间:2008-04-04
不用默认的route,你就要为所有的url做route
不明白你为什么不用默认路由,如果有自定义的路由,放在默认路由前面就可以了,不会相互影响。 |
|
| 返回顶楼 | |
|
时间:2008-04-05
zeroleonhart 写道 不用默认的route,你就要为所有的url做route
不明白你为什么不用默认路由,如果有自定义的路由,放在默认路由前面就可以了,不会相互影响。 是为了使用REST,注销后当是有加route的。 比如: ... map.resources :brands ... ------------------------- <%=form.select(:id, @class, {:prompt => "请选择"}, { "onchange" => remote_function( :with => "'parent_id='+value", :update => 'next_select', :url => {:action => "select_with_class"} ) })% 但面这个不知道是什么原因有错误。是AJAX方式的选择框. 应该怎么路由呢。 |
|
| 返回顶楼 | |
|
时间:2008-04-06
:url => {:controller => '控制器',:action => "select_with_class"} ) })%
|
|
| 返回顶楼 | |
|
时间:2008-04-07
pure 写道 :url => {:controller => '控制器',:action => "select_with_class"} ) })%
情况和以前是一样的。 ActionController::RoutingError in Brands#new Showing brands/_form.rhtml where line #11 raised: No route matches {:controller=>"brands", :action=>"select_with_brandclass"} |
|
| 返回顶楼 | |
|
时间:2008-04-07
你这个url似乎也不是RESTful的吧。。。
如果是restful的url, 你应该可以使用默认提供的一系列url的helper functions |
|
| 返回顶楼 | |
|
时间:2008-04-07
实在不行就定义具名路由吧!要么你需要指定一个restful 路由。你可以运行路由任务,查看列出的路出中是否有你这个路由,没有的话你就要手工加上。
|
|
| 返回顶楼 | |
|
时间:2008-04-07
默认就index等7个方法,如果要使用其它的,需要用:collections=> 或 :member=> 指定
|
|
| 返回顶楼 | |






