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

  • SEARCH
  • Home
  • 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 6587557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:55:56+00:00 2026-05-25T16:55:56+00:00

I am using Ruby on Rails 3.0.10 and I am upgrading my RoR to

  • 0

I am using Ruby on Rails 3.0.10 and I am upgrading my RoR to the version 3.1.0. I am following the Upgrading to Rails 3.1 railscast and on the time 07:04 he starts to talk about problems on loading image files…

In few words:

[…] This (that is, image loading – more information here) won’t work as our application’s images are no longer in the /public/images directory. The simplest solution might appear to be to change the image’s URL from /images/railscasts_logo.png to /assets/railscasts_logo.png and while this will appear to work in development mode we’ll run into issues in production. […] We should instead always use the helper methods. This will link the image correctly in both development and production mode. […]

My problem is in my CSS files where I have statements like the following

.a_class {
    ...
    background-image: url("/images/avatar.png");
    ...
}

that, as well as it should be, do not load correctly image files.

How can I solve that problem in Rails 3.1?

  • 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-05-25T16:55:56+00:00Added an answer on May 25, 2026 at 4:55 pm

    You might have a look into railsguides, especially the part on the asset pipeline (http://guides.rubyonrails.org/asset_pipeline.html).

    In section 2.2.2 CSS and SASS you’ll find the following explanation:

    When using the asset pipeline, paths to assets must be re-written and sass-rails provides _url and _path helpers for the following asset classes: image, font, video, audio, javascript, stylesheet.

    image-url("rails.png") becomes url(/assets/rails.png)
    image-path("rails.png") becomes "/assets/rails.png".
    

    The more generic form can also be used but the asset path and class must both be specified:

    asset-url("rails.png", image) becomes url(/assets/rails.png)
    asset-path("rails.png", image) becomes "/assets/rails.png"
    

    There is also an alternavtive way by adding an .erb-extension instead of the default .sass, which is described in section 2.2.1. But I prefer the sass-way anyway.

    Edit:

    You might also want to check this post here on stackoverflow.

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

Sidebar

Related Questions

When using Ruby on Rails or other framework, a lot of time we generate
We are using Ruby 1.8.7 in dev and production with various version of rails.
So I am creating a time tracking application using Ruby On Rails and am
I am using Ruby (Ruby on Rails) and have a nested set of about
using Ruby on Rails 2.3.2, since I already created Scaffold for Story, so instead
I am using Ruby on Rails. I want to create a filter field on
I am using ruby on rails with a MySQL backend. I have a table
I'm using Ruby on Rails to make an application where businesses can create accounts
I am using Ruby on Rails and I need to store a search result
I'm using ruby on rails 2.3.2 and also using the acts_as_taggable_on puglin. That generated

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.