运行rails server时出现以下错误:
ActionController::RoutingError (No route matches [GET] "/assets/scaffold.css")
这是development.rb文件:
Depot::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
# Show full error reports and disable caching
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = false
# Print deprecation notices to the Rails logger
config.active_support.deprecation = :log
# Only use best-standards-support built into browsers
config.action_dispatch.best_standards_support = :builtin
# Do not compress assets
config.assets.compress = false
# Expands the lines which load the assets
config.assets.debug = true
end
routes.rb文件:
Depot::Application.routes.draw do
get "store/index"
resources :products
root :to => 'store#index', :as => 'store'
end
我尝试输入“config.serve_static_assets = true”但它没有帮助。有谁知道出了什么问题?
答案 0 :(得分:2)
你可能在某个地方弄乱了路线,或者你有一个名为assets_controller
的控制器或其他导致命名与路径/assets/scaffold.css
发生冲突的东西本质上错误告诉你{ {1}}被解释为/assets/scaffold.css
- 意思是......
它认为/controller/action.format
存在,并且您尝试调用assets_controller
操作,请求scaffold
格式的回复。
另外,请确保您的.css
文件按此路径位于scaffold.css