Reputation: 535
I have specified image source in my view as <img src="assets/grid2Whitepressed.png" />
. The file name is index.html.erb file and is part of billings controller. I am getting routing error for this
Started GET "/billings/assets/grid2Whitepressed.png" for 127.0.0.1 at 2013-09-05
17:33:36 +0530
ActionController::RoutingError (No route matches [GET] "/billings/assets/grid2Wh
itepressed.png"):
I am new to rails so not sure if this needs to explicitly defined in routes file. I checked many posts but nowhere its mentioned that we have to define route for assets too. I checked the application.rb, development.rb file settings and everything is as mentioned on ROR site. Please advise. Thanks.
Upvotes: 2
Views: 752
Reputation: 6438
<img src="/assets/yourimage.png"></img>
always give parent directory name for your path.
Upvotes: 1
Reputation: 1776
Apparently the path your route is starting from is /billing. Try this:
<img src="../assets/grid2Whitepressed.png" />
Upvotes: 4