开发者

Rails 3 upgrade - Routes - Uninitialized Constant expecting different name

开发者 https://www.devze.com 2023-02-09 01:40 出处:网络
I\'m upgrading from Rails 2.3.8 to 3.0.3 and am not having fun.I have a route: # for UserApp objects resources :user_apps, :path => \"apps\" do

I'm upgrading from Rails 2.3.8 to 3.0.3 and am not having fun. I have a route:

# for UserApp objects
  resources :user_apps, :path => "apps" do 
    # A UserApp has_many components
    resources :components, :only => [:index, :update], :controller => "user_app"
    # and a UserApp has_one AppConfig object
    resource :app_config, :only => [:show, :edit, :update], :path => "config/basics", :controller => 'config/basics'
  end

The raked routes for this show:

edit_user_app_app_config GET    /apps/:user_app_id/config/basics/edit(.:format)         {:action=>"edit", :controller=>"config/basics"}
     user_app_a开发者_运维技巧pp_config GET    /apps/:user_app_id/config/basics(.:format)            {:action=>"show", :controller=>"config/basics"}
                         PUT    /apps/:user_app_id/config/basics(.:format)           {:action=>"update", :controller=>"config/basics"}

but when I link to this path, I get the error:

uninitialized constant RbConfig::BasicsController

The question is, why did a Rb get prepended here? (and how do I fix it)


I don't know about the Rb. But I'm sure config is some kind of a reserved word. I had a action method named config in a Rails 2.3.5 app which bombed when upgrading to Rails 3. I had to rename it to make it work. Try renaming the controller and see.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号