提问者:小点点

终端、轨道中的actionController路由错误


我正在使用最新版本的rails,每次我在本地主机上运行该站点时,它看起来都很好。

但是,终端打印多个ActionController::RoutingError

开始GET"/资产/图像/用户界面-bg_highlight-soft_100_E1EEF4_1x100. png"127.0.0.1在2013-01-27 23:50:28-0500服务资产 /images/用户界面-bg_highlight-soft_100_E1EEF4_1x100.png-404未找到(3ms)

在救援/布局内呈现 /Users/vicli/.rvm/gems/ruby-1.9.3-p362/gems/actionpack-3.2.11/lib/action_dispatch/middleware/templates/rescues/routing_error.erb(0.9ms)

开始在2013-01-27 23:50:28-0500获取127.0.0.1的"/资产/logoo.png"已提供资产 /logoo.png-304未修改(0ms)[2013-01-27 23:50:28]WARN无法确定响应正文的内容长度。设置响应的内容长度或设置Response#chunked=true

开始GET"/资产/图像/用户界面-bg_glass_65_ffffff_1x400. png"127.0.0.1在2013-01-27 23:50:28-0500服务资产 /images/用户界面-bg_glass_65_ffffff_1x400.png-404未找到(5ms)

这是我的路由. db。

  get "planner/index"

  resources :users
  resources :sessions, only: [:new, :create, :destroy]
  root to:'static_pages#home'

  match '/test', to:'planner#update'
  match '/about', to:'static_pages#about'
 match '/home', to:'static_pages#home'
  match '/planner', to:'planner#index'

  resources :sessions, only: [:new, :create, :destroy]

  match '/signup', to: 'users#new'
  match '/signin', to: 'sessions#new'
  match '/signout', to: 'sessions#destroy', via: :delete

  match '/signup', to:'users#new'


  resources :activities


  resources :restaurants

这就是我跑耙线时得到的

  planner_index GET    /planner/index(.:format)        planner#index
      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
   sessions POST   /sessions(.:format)             sessions#create
new_session GET    /sessions/new(.:format)         sessions#new
    session DELETE /sessions/:id(.:format)         sessions#destroy
       root        /                               static_pages#home
       test        /test(.:format)                 planner#update
      about        /about(.:format)                static_pages#about
       home        /home(.:format)                 static_pages#home
    planner        /planner(.:format)              planner#index
            POST   /sessions(.:format)             sessions#create
            GET    /sessions/new(.:format)         sessions#new
            DELETE /sessions/:id(.:format)         sessions#destroy
     signup        /signup(.:format)               users#new
     signin        /signin(.:format)               sessions#new
    signout DELETE /signout(.:format)              sessions#destroy
                   /signup(.:format)               users#new
 activities GET    /activities(.:format)           activities#index
            POST   /activities(.:format)           activities#create
   new_activity GET    /activities/new(.:format)       activities#new
  edit_activity GET    /activities/:id/edit(.:format)  activities#edit
       activity GET    /activities/:id(.:format)       activities#show
            PUT    /activities/:id(.:format)       activities#update
            DELETE /activities/:id(.:format)       activities#destroy
restaurants GET    /restaurants(.:format)          restaurants#index
            POST   /restaurants(.:format)          restaurants#create
 new_restaurant GET    /restaurants/new(.:format)      restaurants#new
edit_restaurant GET    /restaurants/:id/edit(.:format) restaurants#edit
     restaurant GET    /restaurants/:id(.:format)      restaurants#show
            PUT    /restaurants/:id(.:format)      restaurants#update
            DELETE /restaurants/:id(.:format)      restaurants#destroy

我很确定错误是因为我没有正确配置我的路线,但我不知道如何做到这一点。帮助?


共2个答案

匿名用户

这不是路线问题

你只是在它们必须在的地方没有图像(在/资产/图像/用户界面-bg_highlight-soft_100_E1EEF4_1x100. png路径)

匿名用户

该应用程序期望图像'用户界面-bg_highlight-soft_100_E1EEF4_1x100. png'和其他将在资产中出现.图像可能在一些css中定义.检查你使用的css文件.也,有一个看看布局,因为它们可能也在那里使用.在css中引用图像的正确方法是

background: url(logo25x88.png) no-repeat; #do not set the path if the image is in /assets/images