Welcome to Working With Rails

 

Discussion Forums

Discuss all things Ruby on Rails with perhaps the web's most vibrant group of Ruby on Rails enthusiasts.
bold flash[:notice]
11 Posts
bold flash[:notice]

I am trying to figure out how to make the flash[:notice] bold and if there is any way I can set other CSS styles on it as well.

Thanks!

Display your notice inside an html element like this.

Then style the element with css how ever you like.

notice {

font-weight: bold; }

Sorry, I didn't escape my code

Or use something like "Stickies":http://software.pmade.com/stickies.

Can you actually put divs in the controller?

No, that's View code. It's largely frowned upon to put any view code in the controller. However, you will want to set the flash value in the controller.

I have to second Chris Barnes and recommend you use a CSS style to control the appearance of the tag.

i'm afraid flash[:notice] is already deprecated in rails latest version

yes, my mistake what i mean is flash declared as instance variable already deprecated. Others can be referred here :http://www.rubyonrails.org/deprecation :)

to clarify for anyone still confused, @flash[:whatever] is deprecated, flash[:whatever] works as expected

application.rhtml:


       
      
      
       "flash_"+type.to_s) -%> 

stylesheet.css:


#flash_error {
    border: 2px solid #8B0000;
    padding:10px;
    background-color:#CD5C5C;
    color:gold;
    font-weight:bold;
}

#flash_notice {
    border: 1px solid green;    
    padding:10px;    
    background-color:#3CB371;
    color:#FFFF00;
    font-weight:bold;
}

:)

11 Posts
Login to add your message