Loading images from assets/images in rails 4 app -


i have js.erb file makes reference sprites file have stored under app/assets/images

js.erb file

this.image.src = "<%= image_path('sprites.png') %>"; 

i have added following config/environment/development.rb file

config.assets.compile = true 

and ran

rake assets:precompile 

i still getting 404 bad request error when trying load image. please taking way longer should.

i think config.assets.compile = true in production.rb

and no need add in development.rb

but if want debug assets in development. might change line:

config.assets.debug = true // default false 

additional info:

image_path("sprites.png") # => "/assets/sprites.png"  image_url("sprites.png") # => "http://www.example.com/assets/sprites.png" 

to make sure run precompile in development

rake assets:precompile rails_env=development