Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8870877
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:50:41+00:00 2026-06-14T17:50:41+00:00

I’m brand new to rails (and coding in general) so I’ve a quick question

  • 0

I’m brand new to rails (and coding in general) so I’ve a quick question on retrieving images from a database

Running rails 3.2.8

I have a list of products, code, description, price and product_image in the database, The product images is stored as 123.jpg in the database and the image itself is stored in app/assets/images folder

In my view I have the following code

    <div class="center_content">

<div class="center_title_bar">Latest Products</div>

            <% @camera_catalogues.each do |camera_catalogue| %>

    <div class="prod_box">
        <div class="top_prod_box"></div>
        <div class="center_prod_box">            
             <div class="product_title"><a href="details.html"><%= camera_catalogue.model_description %></a></div>
             <div class="product_img"><a href="details.html"><%= link_to (image_tag camera_catalogue.product_image),camera_catalogue %></a></div>
             <div class="prod_price"><span class="reduce">350$</span> <span class="price"><%=number_to_currency(camera_catalogue.price, :unit =>"&euro;")%> </span></div>                        
        </div>
        <div class="bottom_prod_box"></div>             
        <div class="prod_details_tab">
        <a href="#" title="header=[Add to cart] body=[&nbsp;] fade=[on]"><img src="assest/cart.gif" alt="" title="" border="0" class="left_bt" /></a>
        <a href="#" title="header=[Specials] body=[&nbsp;] fade=[on]"><img src="assest/favs.gif" alt="" title="" border="0" class="left_bt" /></a>
        <a href="#" title="header=[Gifts] body=[&nbsp;] fade=[on]"><img src="assets/favorites.gif" alt="" title="" border="0" class="left_bt" /></a>           
        <a href="details.html" class="prod_details">details</a>            
        </div>                     
    </div>

Everything displays correctly except that the image is not retrieved from the database
which is this line

    <div class="product_img"><a href="details.html"><%= link_to (image_tag camera_catalogue.product_image),camera_catalogue %></a></div>

Does the image in the database need to be saved with a different url. i.e. instead of 123.jpg it is saved as assets/123.jpg

or is there some other error in my code.

Help/advice greatly appreciated 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T17:50:43+00:00Added an answer on June 14, 2026 at 5:50 pm

    Use it like this

     <div class="product_img"><%= link_to (image_tag (camera_catalogue.product_image)),camera_catalogue %></div>
    

    I guess it will work for you. You need not use ‘assests/image_name’

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a view passing on information from a database: def serve_article(request, id): served_article
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
This could be a duplicate question, but I have no idea what search terms
I have a text area in my form which accepts all possible characters from
I don't have much knowledge about the IPv6 protocol, so sorry if the question
I am currently running into a problem where an element is coming back from
I have a reasonable size flat file database of text documents mostly saved in
I have a bunch of posts stored in text files formatted in yaml/textile (from
Let's say I'm outputting a post title and in our database, it's Hello Y&#8217;all

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.