0

我有这些网址:

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

当我输入 rake routes 时,我有以下输出

 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

如您所见,资源 :assets 没有路由。

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

谢谢

4

1 回答 1

2

我想我在这里这里找到了你的答案。

尝试将此行添加到您的application.rb

config.assets.prefix     = "/new_route"

编辑-这里还有一些其他选项来解决问题....

于 2012-06-18T16:30:21.560 回答