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 9195823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:42:50+00:00 2026-06-17T21:42:50+00:00

newb to RoR, but I’d prefer to NOT hard code my image path in

  • 0

newb to RoR, but I’d prefer to NOT hard code my image path in application.css:

.nav {
  padding-top: 10px;
  height: 60px;
  background-image:url('/assets/static/bg-nav.png');
  background-repeat:repeat-x;
}

I’m also getting errors other places because of this. It took me to a couple tries to find that full path, but is there another tag I’m supposed to use? I previously had:

background-image:url('../images/static/bg-nav.png')

Which makes sense if you look at the directory tree, but somehow turns into something else. If I need to inline some rails here, does the file need to change to .css.erb?

Thank you.

  • 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-17T21:42:51+00:00Added an answer on June 17, 2026 at 9:42 pm

    nevermind, i just started reading up more on the asset pipeline. here’s an example of how to programmatically insert the appropriate path within your .css files (and no, do not need to be of other extension type):

    .class { background-image: url(<%= asset_path '/mysubdirectory/myimage.png' %>) }
    

    from: http://guides.rubyonrails.org/asset_pipeline.html

    You begin the path from the app/assets/images/

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

Sidebar

Related Questions

I apologize for the newb question but have not found a solution online. I
It may be a newb questions, but still. I'm working on iOS 6 application
I'm not a newb to JavaScript but this is my first foray into Acrobat
Please forgive the newb question, but I am not finding answers elsewhere... probably because
I'm a newb to RoR. I'm using the book Agile Web Development with Rails
Newb questions incoming. I'm running MySQL locally and I am having a really hard
I'm a total newb to LINQ. Here is the code I have so far:
Newb RoR developer here, standing at the finish line of my first paying Rails
Total newb to .NET programming (and AJAX) but I've been working on this program
complete newb quesiton here, but I'm new to C# and Visual Studio 2010. How

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.