Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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!