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

The Archive Base Latest Questions

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

I have implemented an application helper to dynamically provide the class of a flash

  • 0

I have implemented an application helper to dynamically provide the class of a flash message to the view for styling with Bootstrap. The setup works but along with the ERB, the actual parameters hash is being output to the view. I have look at all of my application code in the helpers and views and can’t pinpoint the source. I’ve also looked at the output HTML and it was not indicative of the source problem. Below are the helpers and views as well as a snapshot of the troubled output result.

Troubled View Output

http://screencast.com/t/9KZHxjqm1Pq

—

# layouts/application.html.erb
...
</head>
<body>

  <%= render "layouts/header" %>

  <div class="container">


  <% if flash.any? %>
  <%= render 'shared/flash_messages' %>
  <% end %>

  <%= yield %>
  ...

—

# views/shared/_flash_messages.html.erb
<div>
<%= flash.each do |key, value| %>
  <div class="<%= flash_class(key) %> fade in">
    <a href="#" data-dismiss="alert" class="close">x</a>
    <%= "#{value}" %>
  <% end %>
  </div>
</div>

—

# helpers/application_helper.rb
module ApplicationHelper

  def  flash_class(level)
  case level
    when :notice then "alert alert-info"
    when :success then "alert alert-success"
    when :error then "alert alert-error"
    when :alert then "alert alert-error"
  end
end

end
  • 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:58:48+00:00Added an answer on June 9, 2026 at 8:58 am

    It’s because you are doing

     <%= flash.each
    

    So the result of each is displayed, as well as anything produced by the block. Change the <%= to <%

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

Sidebar

Related Questions

I have implemented lucene for my application and it works very well unless you
I have successfully implemented a network application in visual CLR project using boost.asio. but
I have implemented an application using jQuery on PhoneGap. In that I'm using a
I have implemented an application with multiple check boxes with multiple layouts.I am invisible
I have implemented an application for modify the xml layout with some properties. I
we have implemented a web application in asp.net 4.0 and customer needs us to
I have implemented an iframe into my flex application. The iframe contains a google
I have implemented solr search for my rails application. I have indexed the fields
We have implemented SSO in a .NET web application using Windows Identity Foundation (WIF).
I have implemented a CorePlot graph in my iOS application, however I am unable

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.