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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:59:50+00:00 2026-06-09T08:59:50+00:00

I have a Rails 3 application that is using the 960 grid CSS layout(s).

  • 0

I have a Rails 3 application that is using the 960 grid CSS layout(s). There are a couple of different views that stretch in width and I am trying to come up with a good way to dynamically change out those classes.

For Example:
My Devise Controllers (Sessions, Passwords, etc) all use a certain class to restrict the width to 340px, while most of my other controllers use another class to restrict the width to 540px

So my 340px layout uses class names grid_6 push_5, while my 540px layout uses grid_10 push_3

Anyway to grab the accessed controller in the application_controller? My thinking is to just get the controller and have a switch statement that sets the class names in a helper_method.

Thoughts?

  • 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-09T08:59:51+00:00Added an answer on June 9, 2026 at 8:59 am

    I was able to figure it out, thanks to this post: Determine the requested Controller in – ApplicationController

    Here is how I ended up doing it (application.html.erb):

    <%= render :partial => 'common/content_container', :locals => { :controller => params[:controller] } %>
    

    content_container partial:

    <% case controller
        when "sessions", "passwords"
            container_div_grid_number = "6"
            container_div_push_number = "5"
        else
            container_div_grid_number = "10"
            container_div_push_number = "3"
        end 
    %>
    
    <div class="grid_<%= container_div_grid_number %> push_<%= container_div_push_number %> ">
        <div class="top_<%= container_div_grid_number %>"></div>
        <div class="middle_<%= container_div_grid_number %>">
            <%= yield %>
        </div>
        <div class="bottom_<%= container_div_grid_number %>"></div>
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a rails application that I deploy on Heroku. I'm using several different
I have a Ruby on Rails application that is using HAML based template views.
I have a rails application that allows searches using longitude and latitude. I have
In my rails application I have a rake task that reads emails using imap.
I have a rails application that has three different types of users and I
I have a ruby 1.9 rails 3.0.7 application that is using lucid/solr to index
So I have a rails application that has two different navigation headers. One that
I have a Rails application that accepts file uploads of CSV files. When developing
I have a rails application that about 3 years old, and I'm having a
I have a Rails application that uses ActiveRecordStore for sessions. I need a PHP

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.