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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:09:51+00:00 2026-05-31T05:09:51+00:00

I am attempting to build a simple content management system using Twitter’s Bootstrap for

  • 0

I am attempting to build a simple content management system using Twitter’s Bootstrap for a small site and I’m running into an issue with the views.

Rails version is 3.0.10

I want to allow the user to create their own pages so I have a Pages controller that has all your standard RESTful methods. Since these can have crud applied to them, they can only be accessed by a logged-in administrator.

So… I have a Public controller that sets the @pages and @page instance variables and uses those to display them in the public Show view.

Here is the Public controller – pretty simple:

  def index
    @pages = Page.all
  end

  def show
    @pages = Page.all
    @page = Page.find(params[:id])    
  end

The reason that there is a @pages instance variable on the ‘index’ method is because I have a welcome page that loads and I’m passing in @pages to populate the navigation elements dynamically:

    <div class="nav-collapse">
          <ul class="nav">
            <li><%= link_to "Welcome", public_index_path, :class => 'active', :id => 'menu_home' %></li>

          <% @pages.each do |page| %>
             <li><%= link_to page.title, public_path(page) %></li>
          <% end %>           

          </ul>
   </div><!--/.nav-collapse -->

The content of the Public controller’s ‘show’ method (which contains an individual page) is passed into the <%= yield %> statement in the applicaton.html.erb file:

<div class="container">    

  <%= yield %>
  <hr>

  <footer>
    <p>My site</p>
  </footer>

</div> <!-- /container -->

So far, this is working fine.

The problem is that when I click the link that takes me to the public_path(page) – I get the content as it should appear, but I lose all my styles. I’m actually getting a 404 error on my stylesheets:

enter image description here

All of these style sheets were loading in just fine on the http://localhost:3000/public page, but when it goes to http://localhost:3000/public/1 – that’s when all the styles disappear. But, they are both using the same layout.

Here is what the log file shows when the request is made:

Started GET "/public/1" for 127.0.0.1 at 2012-03-03 21:14:49 -0600
  Processing by PublicController#show as HTML
  Parameters: {"id"=>"1"}
  [1m[35mPage Load (1.0ms)[0m  SELECT "pages".* FROM "pages"
  [1m[36mPage Load (0.0ms)[0m  [1mSELECT "pages".* FROM "pages" WHERE "pages"."id" = 1 LIMIT 1[0m
Rendered public/show.html.erb within layouts/application (24.0ms)
Completed 200 OK in 63ms (Views: 51.0ms | ActiveRecord: 1.0ms)


Started GET "/public/stylesheets/bootstrap.css" for 127.0.0.1 at 2012-03-03 21:14:50 -0600

ActionController::RoutingError (No route matches "/public/stylesheets/bootstrap.css"):


Rendered c:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/actionpack-3.0.10/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (2.0ms)


Started GET "/public/stylesheets/bootstrap-responsive.css" for 127.0.0.1 at 2012-03-03 21:14:50 -0600

ActionController::RoutingError (No route matches "/public/stylesheets/bootstrap-responsive.css"):


Rendered c:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/actionpack-3.0.10/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (1.0ms)


Started GET "/public/stylesheets/elements.less" for 127.0.0.1 at 2012-03-03 21:14:51 -0600

ActionController::RoutingError (No route matches "/public/stylesheets/elements.less"):


Rendered c:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/actionpack-3.0.10/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (3.0ms)

Thanks for having a look

  • 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-31T05:09:51+00:00Added an answer on May 31, 2026 at 5:09 am

    I managed to find my own answer…

    The Rails helper stylesheet_link_tag was generating a relation attribute of type “stylesheet” when the Less css files needed a relation of type “stylesheet/less”.

    The fix was specifying the relation like this:

     <%= stylesheet_link_tag 'elements.less', :rel => 'stylesheet/less' %>
     <%= stylesheet_link_tag 'main.less', :rel => 'stylesheet/less' %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using System.Linq.Expressions I was attempting to build a simple LambdaExpression that includes a
I am attempting to build a simple WPF Application using msbuild via a custom
I'm attempting to build a simple authentication system built around RFID. Basically I have
I'm attempting to build a small gallery site with WordPress, where there are several
I am attempting to build a simple method that creates an XML file from
I'm attempting to build a simple plugin like this (function($) { $.fn.gpSlideOut = function(options,
I'm attempting to build Python 2.6.2 from source on my Linux system. It has
I'm attempting to build a very simple wxPython GUI that monitors and displays external
I am attempting to build a simple C# TCP proxy for my business so
I am attempting to build a particle system utilizing CUDA to do the heavy

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.