ruby on rails - Bizarre Rails4 error when using link_to -
this line of code:
<%=link_to('click video.', image_path("create_institution.gif"), :target => "_blank")%>
is throwing error:
couldn't find image 'id'=create_institution request parameters {"action"=>"show", "controller"=>"images", "id"=>"create_institution", "format"=>"gif"}
is problem routes or else? "create_institution.gif"
in /assets/images
have model "images" have not had problem using images elsewhere.
pastebin of my routes.rb
in application, have image
resource , why image_path
resolves images#show
from documentation of image_path
,
if have images application resources method may conflict named routes. alias path_to_image provided avoid that. rails uses alias internally, , plugin authors encouraged so.
so, can use path_to_image
resolve this.
<%=link_to('click video.', path_to_image("create_institution.gif"), :target => "_blank")%>
hope helps!
Comments
Post a Comment