Reputation: 53
I have a js.erb file that makes reference to a sprites file which i have stored under app/assets/images
js.erb file
this.image.src = "<%= image_path('sprites.png') %>";
I have added the following to my config/environment/development.rb file
config.assets.compile = true
and ran
rake assets:precompile
I am still getting a 404 bad request error when trying to load the image. Please help this is taking way longer than it should.
Upvotes: 0
Views: 3246
Reputation: 3615
I think config.assets.compile = true is in production.rb
and NO need to add in development.rb
But if you want to debug assets in development. You might change this line:
config.assets.debug = true // default is false
Additional Info:
image_path("sprites.png")
# => "/assets/sprites.png"
image_url("sprites.png")
# => "http://www.example.com/assets/sprites.png"
To make sure you run the precompile in Development
rake assets:precompile RAILS_ENV=development
Upvotes: 2