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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:18:40+00:00 2026-06-17T08:18:40+00:00

Im using twitter bootstrap to style my app. This is my controller action used

  • 0

Im using twitter bootstrap to style my app.

This is my controller action used to define the flash msg:

def generate_rating_set
  redirect_to "/", :flash => { :notice => "New Set Successfully Created." }
end

and in my view

<div class="alert alert-success"><%= flash[:notice] %></div>

and my css

.alert {
   font-weight: bold;
   -moz-border-radius: 4px 4px 4px 4px;
   -webkit-border-radius: 4px 4px 4px 4px;
   border-radius: 4px 4px 4px 4px;
   margin-bottom: 18px;
   padding: 12px 25px 12px 24px;
   -moz-box-shadow: 3px 3px 1px 1px #CCCCCC;
   -webkit-box-shadow: 3px 3px 1px 1px #CCCCCC;
   box-shadow: 3px 3px 1px 1px #CCCCCC;
}
.alert-success {
   background-color: #66E167;
   border-color: #D6E9C6;
   width: 280px;
   color: black;
   padding-top: 20px;
}

The flash message displays as expected, however the css styling is always being displayed. How do I hide the styling to only display when the flash message is being displayed.

  • 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-17T08:18:41+00:00Added an answer on June 17, 2026 at 8:18 am

    Here’s a helper I use to display my flash messages:

    def show_flash(options = {})
        output = ActiveSupport::SafeBuffer.new
    
        [:alert, :notice].each do |message|
            output << content_tag(:p, class: [message, options[:class]], tabindex: '0') do
                flash[message]
            end if flash[message].present?
    
            flash[message] = nil
         end
    
         output
    end
    

    The point is, you don’t want to display the container of the flash message if there are none.

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

Sidebar

Related Questions

I am using Twitter Bootstrap to style validation_errors for a registration page: <?php echo
Is it possible to style default JS alerts using Twitter Bootstrap? For example: alert(You
I'm working on a web app using Twitter Bootstrap. In one of our views,
Going nuts here. I'm developing a rails app, and I'm using the twitter-bootstrap-rails gem
In my rails app, I'm using Twitter bootstrap. Before, everything was working fine, but
I am working on a really simple app that is styled using twitter-bootstrap-rails. One
I have this (using the Twitter bootstrap css sheet): <!DOCTYPE html> <html lang=en> <head>
I'm using twitter bootstrap and my nav bar works fine with collapse function. This
I have a rails 3.2 app using Twitter Bootstrap via the gem ' twitter-bootstrap-rails
I'm using twitter bootstrap for some web app I'm forced to do (I'm not

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.