Eric Baldwin
Eric Baldwin

Reputation: 3491

Rails CSS not loading with Ruby 2.0

I am having an issue with loading CSS in my Rails app. I have pulled the same repository on two machines.

On one machine, the CSS file is loaded correctly. When I go to a page on this machine, I get the following in my terminal:

Started GET "/" for 127.0.0.1 at 2013-03-06 19:03:32 -0500
Processing by HomeController#show as HTML
Compiled collaborators.css  (6ms)  (pid 862)
Compiled home.css  (145ms)  (pid 862)
Compiled patents.css  (0ms)  (pid 862)
Compiled projects.css  (64ms)  (pid 862)
Compiled users.css  (2ms)  (pid 862)
Compiled application.css  (308ms)  (pid 862)
Compiled jquery.js  (3ms)  (pid 862)
Compiled jquery_ujs.js  (0ms)  (pid 862)
Compiled collaborators.js  (129ms)  (pid 862)
Compiled home.js  (0ms)  (pid 862)
Compiled jquery.1.8.2.js  (5ms)  (pid 862)
Compiled patents.js  (186ms)  (pid 862)
Compiled projects.js  (0ms)  (pid 862)
Compiled users.js  (0ms)  (pid 862)
Compiled application.js  (1185ms)  (pid 862)
  User Load (1.4ms)  SELECT "users".* FROM "users" WHERE "users"."id" = 13945 LIMIT 1
  Rendered layouts/_header.html.erb (95.7ms)
  Rendered home/show.html.erb within layouts/application (2088.1ms)
Completed 200 OK in 2114ms (Views: 2104.9ms | ActiveRecord: 8.3ms)

When I load the same page on another machine, I get the following in the terminal

Started GET "/" for 127.0.0.1 at 2013-03-06 19:31:19 -0500
Processing by HomeController#show as HTML
  User Load (0.3ms)  SELECT "users".* FROM "users" WHERE "users"."id" = 460 LIMIT 1
  Rendered layouts/_header.html.erb (3.4ms)
  Rendered home/show.html.erb within layouts/application (5.8ms)
Completed 200 OK in 11ms (Views: 10.7ms | ActiveRecord: 0.3ms)

But none of the CSS compiles. It also doesn't show up in the browser. What could be the problem?

UPDATE: I ran rake assets:precompile on the second machine and it worked. However, deleting the public/assets folder stopped it from working. This means it was not live compiling. Any idea why?

Upvotes: 0

Views: 1088

Answers (3)

CCD
CCD

Reputation: 336

I noticed some issues related to assets in ruby 2.0 as well, i.e., Applications running in 1.9.3 without problems having CSS issues.

Could you try to see if this helps:

Add to your Gemfile:

gem 'sprockets', '~> 2.9.0'

Then bundle install and try again...

Upvotes: 1

RoRRe
RoRRe

Reputation: 291

whats the content of you config/environments/development.rb

sepcifically --.

config.assets.compile = false/true ?

Upvotes: 2

Richard Brown
Richard Brown

Reputation: 11436

Is the second machine running in the production environment? The CSS is only compiled in development.

Upvotes: 0

Related Questions