Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

Can't load css and js files in Ruby App.

I have a problem with "Build a Simple Ruby on Rails Application", after struggle with Rails 4 I downgraded and started from the beginning with Rails 3.2.6 and treehouse VirtualBox, but now I have another problem: I can't load css and js files. I only get application.css and apllication.js.

<head>
  <title>Treebook</title>
  <link href="/assets/application.css?body=1" media="all" rel="stylesheet" type="text/css" />
  <script src="/assets/application.js?body=1" type="text/javascript"></script>
  <meta content="authenticity_token" name="csrf-param" />
<meta content="yQhc6O2PTM8cVC54930W4EYkXqOggTDtwz+8yocyd4Y=" name="csrf-token" />
</head>

5 Answers

Nathan F.
Nathan F.
30,773 Points

Where are you placing your additional CSS and JS files? Rails uses an asset pipeline that by default concatenates all of your CSS and JS assets together, and it looks for these assets in a particular folder.

app > assets > css(js)

I think the issue might be with Ruby version(I found similar problem on StackOverflow.com) , it's 2.0 and should be 1.9.3 to work properly . I will try to downgrade and see what happens.

After downgrading to 1.9.3 everything works fine.

Nathan F.
Nathan F.
30,773 Points

Good to see you got it sorted out!