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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T17:09:57+00:00 2026-05-17T17:09:57+00:00

For my rails app, I use a fixed layout with 2 columns (a main

  • 0

For my rails app, I use a fixed layout with 2 columns (a main and a rightside).
For now, flash messages are displayed in the content div but I would like to show flash msg in the “main” div ( main < content < container ).

I don’t know what it the best to do it. In fact, did I have to create a flash message helper and add it in all my views, did I have to create a partial, to change something with the layout or is there another solution?

Here is my application.html.erb structure:

...
<body>
  <div id="container">
    <%= render 'layouts/header' %>
    <div id="content">
      <% flash.each do |name, msg| %>
        <%= content_tag :div, msg, :id => "flash_#{name}" %>
      <% end %>
      <%= content_tag :h1, yield(:title) if show_title? %>
      <%= yield %>
    </div>
    <%= render 'layouts/footer' %>
  </div>
</body>
...

and for example one of my views: (home/index.html.erb)

<div id="rightside">
  ...
</div>
<div id="main">
  ... <-- Here I want to display flash!
</div>

Thanks for any suggestions!

  • 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-17T17:09:58+00:00Added an answer on May 17, 2026 at 5:09 pm

    Two options come to mind:

    1) Use absolute positioning to move the flash message over, accounting for the offset created by the sidebar.

    2) Just move your flash message code over to the view where you want it to appear. This would require more duplication of code, but you could put it in a partial so it’d be a single line in your views at most.

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

Sidebar

Related Questions

In my rails app I use the validation helpers in my active record objects
In a Rails app sometimes you use a redirect in an action... redirect_to :controller
I have a Ruby script in my Rails app that I use to load
I have a rails app that has picked up a bit of traction, but
I'm in the process of converting my Rails app to use mongodb through mongoid.
Specifically, I have a number of pages in my Rails app that use the
In my Rails app I have a has_many_through relation. I want to use the
I'm studying how to use caching in Heroku for my Rails app. HTTP cache
Is there any way to use text messages to CRUD data in a Rails
For integration tests of my Rails web app I use Steak (something like Cucumber).

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.