0

I've started a new Rails (4.2.2) app, only with some basic functionality. But the javascript and css files aren't rendered:

chrome displaying the 404

I have installed the sprockets gem and I've tried explicitly adding the 'sprockets' gem to my Gemfile (and running bundle install), but it didn't help.

Here is my application.js:

//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .

And these two lines are in my application.html.erb

<%= stylesheet_link_tag    'default', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'default', 'data-turbolinks-track' => true %>

And they render as follows: enter image description here

I have Ruby 2.1.6p336 installed on Windows 8.1 Does somebody know where to look for answers or know what is going wrong? I'm pretty new to rails.

Karamazovi
  • 55
  • 1
  • 9

1 Answers1

1

i think you need to change your javascript and stylesheet tag like this. it fetches details from application.js and application.css not from default ones

<%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
Athar
  • 3,258
  • 1
  • 11
  • 16
  • That does solve the issue for the css, but it raises an error for the javascript: `Showing e:/GitRepos/books/app/views/layouts/application.html.erb where line #6 raised: TypeError: This property or method is not supported by this object` – Karamazovi Jul 22 '15 at 17:31
  • have you made some changes to application.js. or add something which is conflicting with this. – Athar Jul 22 '15 at 17:34
  • No I only edited the two lines you wrote. My application.js is exactly the way it's showed in my question. And yes I am working on Windows – Karamazovi Jul 22 '15 at 17:37
  • 1
    add this to the gem file `gem 'coffee-script-source', '1.8.0'` and then do `bundle update coffee-script-source` and then restart server – Athar Jul 22 '15 at 17:38
  • That did the trick! Thanks :) Is this problem only occuring on Windows without that gem? – Karamazovi Jul 22 '15 at 17:41
  • yes. see this http://stackoverflow.com/questions/28312460/object-doesnt-support-this-property-or-method-rails-windows-64bit. window is not good option for ruby on rails . try linux or mac – Athar Jul 22 '15 at 17:41