我正在使用最新版本的rails,每次我在本地主机上运行该网站时,它看起来都很好。
然而,终端打印多个ActionController :: RoutingErrors
在2013-01-27 23:50:28 -0500开始获取127.0.0.1的“/assets/images/ui-bg_highlight-soft_100_E1EEF4_1x100.png” 已提供资产/images/ui-bg_highlight-soft_100_E1EEF4_1x100.png - 404未找到(3毫秒)
ActionController :: RoutingError(没有路由匹配[GET]“/assets/images/ui-bg_highlight-soft_100_E1EEF4_1x100.png”): actionpack(3.2.11)lib / action_dispatch / middleware / debug_exceptions.rb:21:in
call' actionpack (3.2.11) lib/action_dispatch/middleware/show_exceptions.rb:56:in
call' railties(3.2.11)lib / rails / rack / logger.rb:32:incall_app' railties (3.2.11) lib/rails/rack/logger.rb:16:in
block in call' activesupport(3.2.11)lib / active_support / tagged_logging.rb:22:intagged' railties (3.2.11) lib/rails/rack/logger.rb:16:in
call' actionpack(3.2.11)lib / action_dispatch / middleware / request_id.rb:22:incall' rack (1.4.4) lib/rack/methodoverride.rb:21:in
call' rack(1.4.4)lib / rack / runtime.rb:17:incall' activesupport (3.2.11) lib/active_support/cache/strategy/local_cache.rb:72:in
call' rack(1.4.4)lib / rack / lock.rb:15:incall' actionpack (3.2.11) lib/action_dispatch/middleware/static.rb:62:in
call' railties(3.2.11)lib / rails / engine.rb:479:incall' railties (3.2.11) lib/rails/application.rb:223:in
call' rack(1.4.4)lib / rack / content_length.rb:14:incall' railties (3.2.11) lib/rails/rack/log_tailer.rb:17:in
call' rack(1.4.4)lib / rack / handler / webrick.rb:59:inservice' /Users/vicli/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/webrick/httpserver.rb:138:in
service' /Users/vicli/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/webrick/httpserver.rb:94:inrun' /Users/vicli/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/webrick/server.rb:191:in
阻止在start_thread'在救援/布局内呈现/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的“/assets/logoo.png” 服务资产/logoo.png - 304未修改(0ms) [2013-01-27 23:50:28]警告无法确定响应正文的内容长度。设置响应的内容长度或设置Response#chunked = true
在2013-01-27 23:50:28 -0500开始获取127.0.0.1的“/assets/images/ui-bg_glass_65_ffffff_1x400.png” 已提供资产/images/ui-bg_glass_65_ffffff_1x400.png - 404未找到(5ms)
ActionController :: RoutingError(没有路由匹配[GET]“/assets/images/ui-bg_glass_65_ffffff_1x400.png”): actionpack(3.2.11)lib / action_dispatch / middleware / debug_exceptions.rb:21:in
call' actionpack (3.2.11) lib/action_dispatch/middleware/show_exceptions.rb:56:in
call' railties(3.2.11)lib / rails / rack / logger.rb:32:incall_app' railties (3.2.11) lib/rails/rack/logger.rb:16:in
block in call' activesupport(3.2.11)lib / active_support / tagged_logging.rb:22:intagged' railties (3.2.11) lib/rails/rack/logger.rb:16:in
call' actionpack(3.2.11)lib / action_dispatch / middleware / request_id.rb:22:incall' rack (1.4.4) lib/rack/methodoverride.rb:21:in
call' rack(1.4.4)lib / rack / runtime.rb:17:incall' activesupport (3.2.11) lib/active_support/cache/strategy/local_cache.rb:72:in
call' rack(1.4.4)lib / rack / lock.rb:15:incall' actionpack (3.2.11) lib/action_dispatch/middleware/static.rb:62:in
call' railties(3.2.11)lib / rails / engine.rb:479:incall' railties (3.2.11) lib/rails/application.rb:223:in
call' rack(1.4.4)lib / rack / content_length.rb:14:incall' railties (3.2.11) lib/rails/rack/log_tailer.rb:17:in
call' rack(1.4.4)lib / rack / handler / webrick.rb:59:inservice' /Users/vicli/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/webrick/httpserver.rb:138:in
service' /Users/vicli/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/webrick/httpserver.rb:94:inrun' /Users/vicli/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/webrick/server.rb:191:in
阻止在start_thread'
这是我的routes.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
这就是我在运行rake路线时得到的结果
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
我很确定错误是因为我没有正确配置我的路线,但我不知道该怎么做。帮助
答案 0 :(得分:1)
这不是路线问题
你只有他们必须的图像(在/assets/images/ui-bg_highlight-soft_100_E1EEF4_1x100.png
路径中)
答案 1 :(得分:0)
应用程序希望图像'ui-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