标签:url active 冰山一角 jpg 页面 mfile debug call rri
Started GET "/discount_service/assets/admin.js?body=1" for 127.0.0.1 at 2014-05-23 14:50:24 +0800 ActionController::RoutingError (No route matches [GET] "/discount_service/assets/admin.js"): actionpack (4.0.0) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call‘ actionpack (4.0.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call‘ railties (4.0.0) lib/rails/rack/logger.rb:38:in `call_app‘ railties (4.0.0) lib/rails/rack/logger.rb:21:in `block in call‘ activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `block in tagged‘ activesupport (4.0.0) lib/active_support/tagged_logging.rb:25:in `tagged‘ activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `tagged‘ railties (4.0.0) lib/rails/rack/logger.rb:21:in `call‘ actionpack (4.0.0) lib/action_dispatch/middleware/request_id.rb:21:in `call‘ rack (1.5.2) lib/rack/methodoverride.rb:21:in `call‘ rack (1.5.2) lib/rack/runtime.rb:17:in `call‘ activesupport (4.0.0) lib/active_support/cache/strategy/local_cache.rb:83:in `call‘ rack (1.5.2) lib/rack/lock.rb:17:in `call‘ actionpack (4.0.0) lib/action_dispatch/middleware/static.rb:64:in `call‘ railties (4.0.0) lib/rails/engine.rb:511:in `call‘ railties (4.0.0) lib/rails/application.rb:97:in `call‘ rack (1.5.2) lib/rack/content_length.rb:14:in `call‘ puma (2.6.0) lib/puma/server.rb:486:in `handle_request‘ puma (2.6.0) lib/puma/server.rb:357:in `process_client‘ puma (2.6.0) lib/puma/server.rb:250:in `block in run‘ puma (2.6.0) lib/puma/thread_pool.rb:92:in `call‘ puma (2.6.0) lib/puma/thread_pool.rb:92:in `block in spawn_thread‘
在rails 4 之后没有grop 了 要记得哦
# group :assets do gem ‘sass-rails‘, ‘~> 4.0.0‘ gem ‘coffee-rails‘, ‘~> 4.0.0‘ gem ‘uglifier‘, ‘>= 1.3.0‘ # end # 页面渲染 gem ‘jquery-rails‘ #这个 gem ‘execjs‘ # 记得这个 gem ‘turbolinks‘
config.assets.precompile << Proc.new do |path| if path =~ /\.(css|js|scss|png|jpg|gif|json)\z/ full_path = Rails.application.assets.resolve(path).to_path app_assets_path1 = Rails.root.join(‘app‘, ‘assets‘).to_path app_assets_path2 = Rails.root.join(‘public‘, ‘assets‘).to_path app_assets_path3 = Rails.root.join(‘vendor‘, ‘assets‘).to_path if full_path.starts_with? app_assets_path1 true else if full_path.starts_with? app_assets_path2 true else if full_path.starts_with? app_assets_path3 true else false end end end end end
config.action_controller.relative_url_root = ‘/discount_service‘ #是用来 实用啊 config.serve_static_assets = true # Compress JavaScripts and CSS. config.assets.compress = true config.assets.js_compressor = :uglifier config.assets.css_compressor = :sass
RAILS_ENV=production rake assets:precompile
Rails 4.0.0 开发环境一切正常,到生成环境发现 无法找到 css 和 js
标签:url active 冰山一角 jpg 页面 mfile debug call rri
原文地址:http://www.cnblogs.com/wgwyanfs/p/6726116.html