> Can anyone tell me how to display images which are already stored in > database? > I have a table in which one column stores the url of the image like > usrimg/xxx.gif. How to display this images in view?
If your controller was named pages_controller.rb you would do: def index @pages = Page.all end In the index.html.erb view you would do: (if your table field for the image url was named image_url) <% @pages.each do |page| %> <%= image_tag(page.image_url) %> <% end %> If you want to apply specific formatting for your images and it's going to be repetitive, you could simply create a helper to do the formatting for you and call the helper method in the view. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

