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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T01:23:10+00:00 2026-06-10T01:23:10+00:00

I am learning Rails from Agile Web Development With Rails (4th edition, Rails 3)

  • 0

I am learning Rails from “Agile Web Development With Rails” (4th edition, Rails 3) and I am having trouble getting a stylesheet to apply. To quickly take you through what I have done so far, I first generated a scaffold:

 rails generate scaffold Product title:string description:text image_url:string price:decimal

Then of course:

 rake db:migrate

I then used the db/seeds.rb file to load some data into the products table. When I loaded localhost:3000/products, everything was working great. Now, I copied the stylesheet code the book provides to the products.css.scss file generated by the scaffold:

.products {
  table {
    border-collapse: collapse;
  }
  table tr td {
    padding: 5px;
    vertical-align: top;
  }
 .list_image {
    width:  60px;
    height: 70px;
  }
  .list_description {
    width: 60%;

    dl {
      margin: 0;
    }
    dt {
      color:        #244;
      font-weight:  bold;
      font-size:    larger;
    }
    dd {
      margin: 0;
    }
  }
  .list_actions {
     font-size:    x-small;
     text-align:   right;
     padding-left: 1em;
  }
  .list_line_even {
    background:   #e0f8f8;
  }
  .list_line_odd {
    background:   #f8b0f8;
  }
}

Now, when I load localhost:3000/products, the stylesheet is not being applied.I can see the stylesheet in inspect element, but it is not applying. I have tried everything imaginable. Firstly, I made sure this line of code was in my application.html.erb:

  <%= stylesheet_link_tag "application", :media => "all" %>

Given that my new stylesheet (products.css.scss) is in the assets/stylesheets/ directory, it should be loaded. When I inspect element on localhost:3000/products, I actually see the stylesheet there, but it is not being applied. the next thing I tried was running:

rake assets:precompile

No success. After deleting the public/assets directory, I made sure this line of code was in my config/application.rb file:

 config.assets.enabled = true

It was. Next, I headed over to my assets/stylesheet/application.css file and tried adding this line of code:

*= require products

Once again, no success. Lastly, I tried restarting my server to see if there was an effect. Failure again. I am at dead end here. Please, I would appreciate any and all input on this matter as I am so burnt-out and frustrated with this matter.

  • 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-10T01:23:12+00:00Added an answer on June 10, 2026 at 1:23 am

    i just spent an hour figuring out the answer, since been having the exact same issue myself. go to your application.css.sass and make sure it has

    /* ...
    *= require_self
    *= require_tree .
    */
    

    in it. this auto loads all the other .css.sass in apps/assets/stylesheets, then precompiles them into public/assets/stylesheets to be 1 statis css file, and that is being served to your browser.

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

Sidebar

Related Questions

I am learning to how send email with Rails 3 with Agile Web Development
I am currently reading a book, and learning ruby on rails. (Agile Web Development
Just learning rails, developing first app and having trouble finding a straight answer to
I am learning rails from rails tutorial. I got a problem in the Section
I am coming from the world of PHP and am learning Ruby/Rails. I have
This is a beginner's rails learning confusion. When I learn rails, from time to
As I am learning more about rails, and breaking my design thinking from ASP.Net
Im learning rails and exploring a bit away from the book and creating a
I am learning rais from the rails tutorial book: http://ruby.railstutorial.org/chapters/sign-in-sign-out#fnref:9.14 I am working on
I'm new to rails after moving from PHP and am having no end to

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.