3

Update

Here are the search results for 'asset' in my app (excluding log).

./app/assets/javascripts/application.js:4:// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,

./app/assets/javascripts/application.js:5:// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.

./app/assets/stylesheets/application.css:5: * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,

./app/assets/stylesheets/application.css:6: * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.

./config/application.rb:7: # If you precompile assets before deploying to production, use this line

./config/application.rb:8: Bundler.require(*Rails.groups(:assets => %w(development test)))

./config/application.rb:9: # If you want your assets lazily compiled in production, use this line

./config/application.rb:10: # Bundler.require(:default, :assets, Rails.env)

./config/application.rb:54: # Enable the asset pipeline

./config/application.rb:55: config.assets.enabled = true

./config/application.rb:57: # Version of your assets, change this if you want to expire all your assets

./config/application.rb:58: config.assets.version = '1.0'

./config/environments/development.rb:9: config.assets.enabled = false

./config/environments/development.rb:34: # Do not compress assets

./config/environments/development.rb:35: config.assets.compress = false ./config/environments/development.rb:37: # Expands the lines which load the assets

./config/environments/development.rb:38: config.assets.debug = true

./config/environments/production.rb:11: # Disable Rails's static asset server (Apache or nginx will already do this)

./config/environments/production.rb:12: config.serve_static_assets = true

./config/environments/production.rb:15: config.assets.compress = true

./config/environments/production.rb:17: # Don't fallback to assets pipeline if a precompiled asset is missed

./config/environments/production.rb:18: config.assets.compile = true

./config/environments/production.rb:20: # Generate digests for assets URLs

./config/environments/production.rb:21: config.assets.digest = true

./config/environments/production.rb:23: # Defaults to Rails.root.join("public/assets")

./config/environments/production.rb:24: # config.assets.manifest = YOUR_PATH

./config/environments/production.rb:45: # Enable serving of images, stylesheets, and JavaScripts from an asset server

./config/environments/production.rb:46: # config.action_controller.asset_host = "http://assets.example.com"

./config/environments/production.rb:48: # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)

./config/environments/production.rb:49: # config.assets.precompile += %w( search.js )

./config/environments/test.rb:10: # Configure static asset server for tests with Cache-Control for performance

./config/environments/test.rb:11: config.serve_static_assets = true

./Gemfile:30:# Gems used only for assets and not required

./Gemfile:32:group :assets do ./README.rdoc:159: | |-- assets

./README.rdoc:192: |-- assets ./README.rdoc:199:app/assets

I also tried including the asset tags in raw html, as in <script src="assets/application.js"></script>, but it didn't work either.


I'm working on a Rails 3.2.13 app and have encountered the following problem: the app/assets files don't seem to get run!

In my application.html.erb file:

  <%= stylesheet_link_tag    "application" %>
  <%= javascript_include_tag "application" %>

When I run rails server, I see the following error message in the log:

Started GET "/stylesheets/application.css" for 127.0.0.1 at 2013-07-20 15:34:51
-0400

ActionController::RoutingError (No route matches [GET] "/stylesheets/application .css"):
actionpack (3.2.13) lib/action_dispatch/middleware/debug_exceptions.rb:21:in ` call'
actionpack (3.2.13) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.13) lib/rails/rack/logger.rb:32:in `call_app'
railties (3.2.13) lib/rails/rack/logger.rb:16:in `block in call'
activesupport (3.2.13) lib/active_support/tagged_logging.rb:22:in `tagged'
railties (3.2.13) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.13)lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.5) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.5) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.13) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.5) lib/rack/lock.rb:15:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/static.rb:63:in `call'
railties (3.2.13) lib/rails/engine.rb:479:in `call'
railties (3.2.13) lib/rails/application.rb:223:in `call'
rack (1.4.5) lib/rack/content_length.rb:14:in `call'
railties (3.2.13) lib/rails/rack/log_tailer.rb:17:in `call'
rack (1.4.5) lib/rack/handler/webrick.rb:59:in `service'
c:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
c:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
c:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'

Rendered
c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/templates/rescues/routing_error.erb
 within resc ues/layout (1.0ms)

At the same time, there are error messages for the other assets as well (js files, css etc). Another example:

Started GET "/javascripts/application.js" for 127.0.0.1 at 2013-07-20
15:34:51 - 0400 ActionController::RoutingError (No route matches [GET] "/javascripts/application .js"): ...

I've tried restarting the server, restarting my computer, but it doesn't help. I have also attempted copying development.rb and production.rb files from other functional apps, but no effect either.

Can anyone please help?


Here are my assets search path, by running Rails.application.config.assets.paths:

["c:/Users/user/rails_projects/fyff/app/assets/images", "c:/Users/user/rails_ projects/fyff/app/assets/javascripts", "c:/Users/user/rails_projects/fyff/app/as sets/stylesheets", "c:/Users/user/rails_projects/fyff/vendor/assets/javascripts" , "c:/Users/user/rails_projects/fyff/vendor/assets/stylesheets", "c:/RailsInstal ler/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/coffee-rails-3.2.2/lib/assets/javascripts ", "c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/bundler/gems/best_in_place-1 152e2256afd/lib/assets/javascripts", "c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/ 1.9.1/bundler/gems/bootstrap-switch-rails-2cb6f83ee23e/vendor/assets/javascripts ", "c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/bundler/gems/bootstrap-switc h-rails-2cb6f83ee23e/vendor/assets/stylesheets", "c:/RailsInstaller/Ruby1.9.3/li b/ruby/gems/1.9.1/gems/jquery-rails-3.0.1/vendor/assets/javascripts", "c:/RailsI nstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bootstrap-sass-2.3.2.0/vendor/assets /images", "c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bootstrap-sass-2 .3.2.0/vendor/assets/javascripts", "c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1. 9.1/gems/bootstrap-sass-2.3.2.0/vendor/assets/stylesheets"]

which looks just fine to me...

15
  • I see a space between file name and .js & .css Jul 20, 2013 at 20:00
  • 1
    How do you include those in your layout? Jul 20, 2013 at 20:01
  • using the conventional include tags, as in update
    – jytoronto
    Jul 20, 2013 at 20:09
  • Do you have asset pipeline enabled? Valid asset pipeline link should be assets/application.js/.css Jul 20, 2013 at 21:38
  • 1
    Come on, I didn't help at all and we still don't know what was the reason! MAybe you can diff those two projects? Jul 22, 2013 at 7:48

3 Answers 3

8

I was getting this error and solved it by running:

RAILS_ENV=production rake assets:precompile

1

You had a space after application .css

0

Fixed by creating a new application and moving all the files there. Asset pipeline now functioning normally.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.