create a image then show in the page not working in ruby on rails -
i use "gruff" draw graph database table
the last step of function create image in folder
bar_chart.write("/home/lawyer/capistrano/current/app/assets/images/graph/lawfirm_#{@lawyer.id}.png")
and in show page :it use image show in div
-if file.exists?("/home/lawyer/capistrano/current/app/assets/images/graph/lawfirm_# {@lawyer.id}.png") = image_tag("graph/lawfirm_#{@lawyer.id}.png")
it works fine in local host .but in production image not shown .
in console log shows error message:
started "/assets/graph/lawfirm_2673.png" 217.86.186.128 @ 2013-05-15 10:19:04 +0200 served asset /graph/lawfirm_2673.png - 404 not found (3ms) actioncontroller::routingerror (no route matches [get] "/assets/graph/lawfirm_2673.png"):
but work. can show image.
at first function of draw graph in same controller , same method "index", hope draw graph first show image. add
before_filter :draw_graph
and move draw graph function in method "draw_graph"
but still same problem
i think because you're generating images in app? if generating them within app , storing them, not work in production if deploy services heroku. need use amazon s3 hold images in production.
this post describes similar problem.
there's gem install aws , decent tutorials this (setup paperclip, same principles apply).
Comments
Post a Comment