Compiled assets are not found in production mode run locally

I have a strange behaviour with compiled assets when running a simple
draft
app locally:

RAILS_ENV=production rake assets:precompile

The aove command generated some css and js with finger printed values:

i.e. application-43dcf2bdff355d2c3053e2aade23881a.css
application-c67be452a576850d0c11559f908180e3.js

etc.

Run in production:

rails s -e production

There are no CSS fiound !

When observing the html source:

There are the following errors in the console as well:

F, [2014-02-18T16:56:36.417436 #4036] FATAL – :
ActionController::RoutingError (No route matches [GET]
“/assets/application-43dcf2bdff355d2c3053e2aade23881a.css”):
actionpack (4.0.2)
lib/action_dispatch/middleware/debug_exceptions.rb:21:in call' actionpack (4.0.2) lib/action_dispatch/middleware/show_exceptions.rb:30:incall’
railties (4.0.2) lib/rails/rack/logger.rb:38:in call_app' railties (4.0.2) lib/rails/rack/logger.rb:20:inblock in call’
activesupport (4.0.2) lib/active_support/tagged_logging.rb:67:in
block in tagged' activesupport (4.0.2) lib/active_support/tagged_logging.rb:25:intagged’
activesupport (4.0.2) lib/active_support/tagged_logging.rb:67:in
tagged' railties (4.0.2) lib/rails/rack/logger.rb:20:incall’
actionpack (4.0.2) lib/action_dispatch/middleware/request_id.rb:21:in
call' rack (1.5.2) lib/rack/methodoverride.rb:21:incall’
rack (1.5.2) lib/rack/runtime.rb:17:in call' activesupport (4.0.2) lib/active_support/cache/strategy/local_cache.rb:83:incall’
rack (1.5.2) lib/rack/sendfile.rb:112:in call' railties (4.0.2) lib/rails/engine.rb:511:incall’
railties (4.0.2) lib/rails/application.rb:97:in `call’

Any idea ? What is wrong here ? Why Rails 4 didn’t see my assets ? It is
just a simpe app with one generated scaffold for posts, nothing special,
no
additional configurations added . really weird.

On Tue, Feb 18, 2014 at 9:29 PM, Javix [email protected] wrote:

Run in production:

rails s -e production

There are no CSS fiound !

This is strange. This issue can occur for individual css and js files
but
application.css and application.js should be added by default.

For other files you have to add config.assets.precompile +=
%w(filename.css).

On Tuesday, 18 February 2014 17:08:47 UTC+1, Ganesh Ranganathan wrote:

This is strange. This issue can occur for individual css and js files but
application.css and application.js should be added by default.

For other files you have to add config.assets.precompile +=
%w(filename.css).

I found the way to make it work:

add/modify the following line in environments/production.rb:

config.serve_static_assets = true
config.assets.compile = true

Then run again

$ RAILS_ENV rake assets:precompile
$ rails s -e production

And it works.

Any idea ?

On Tuesday, February 18, 2014 4:22:23 PM UTC, Javix wrote:

On Tuesday, 18 February 2014 17:08:47 UTC+1, Ganesh Ranganathan wrote:

config.serve_static_assets = true
config.assets.compile = true

The default is for .serve_static_assets to be false, since normally in
production one lets apache, nginx or a CDN handle static assets

Fred

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs