Rails 3.2.1:链接适用于app,存在于routes.rb中,但不显示在rake路由输出上

时间:2012-06-18 16:11:24

标签: ruby-on-rails routes

我有这些网址:

http://localhost:3000/assets
http://localhost:3000/assets/new
http://localhost:3000/assets/34
http://localhost:3000/assets/34/edit

他们在我的应用中工作。

我有这个routes.rb文件:

devise_for :users

match "listings/show_notes" => "listings#show_notes", :as => :show_notes

resources :users

resources :listings

resources :assets

 authenticated :user do
  root :to => "listings#index"
 end

#this route is for file downloads
 match "assets/get/:id" => "assets#get", :as => :download

 resources :admin_dash_board,  :only => :index

当我输入佣金路线时,我有以下输出

 new_user_session GET    /users/sign_in(.:format)       devise/sessions#new
        user_session POST   /users/sign_in(.:format)       devise/sessions#create
 destroy_user_session DELETE /users/sign_out(.:format)      devise/sessions#destroy
       user_password POST   /users/password(.:format)      devise/passwords#create
   new_user_password GET    /users/password/new(.:format)  devise/passwords#new
  edit_user_password GET    /users/password/edit(.:format) devise/passwords#edit
                     PUT    /users/password(.:format)      devise/passwords#update
cancel_user_registration GET    /users/cancel(.:format)            devise/registrations#cancel
   user_registration POST   /users(.:format)               devise/registrations#create
   new_user_registration GET    /users/sign_up(.:format)       devise/registrations#new
 edit_user_registration GET    /users/edit(.:format)          devise/registrations#edit
                     PUT    /users(.:format)               devise/registrations#update
                     DELETE /users(.:format)               devise/registrations#destroy
          show_notes        /listings/show_notes(.:format) listings#show_notes
               users GET    /users(.:format)               users#index
                     POST   /users(.:format)               users#create
            new_user GET    /users/new(.:format)           users#new
           edit_user GET    /users/:id/edit(.:format)      users#edit
                user GET    /users/:id(.:format)           users#show
                     PUT    /users/:id(.:format)           users#update
                     DELETE /users/:id(.:format)           users#destroy
            listings GET    /listings(.:format)            listings#index
                     POST   /listings(.:format)            listings#create
         new_listing GET    /listings/new(.:format)        listings#new
        edit_listing GET    /listings/:id/edit(.:format)   listings#edit
             listing GET    /listings/:id(.:format)        listings#show
                     PUT    /listings/:id(.:format)        listings#update
                     DELETE /listings/:id(.:format)        listings#destroy
                root        /                              listings#index
  admin_dash_board_index GET    /admin_dash_board(.:format)    admin_dash_board#index

正如您所看到的,资源没有路由:资产。

知道为什么吗?或者最近怎么回事?

由于

1 个答案:

答案 0 :(得分:2)

我想我找到了你的答案herehere

尝试在application.rb中添加此行:

config.assets.prefix     = "/new_route"

编辑 - 还有here以及其他一些解决问题的选项....