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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:39:00+00:00 2026-05-26T23:39:00+00:00

This might be an easy one for you guys, but I’m not sure the

  • 0

This might be an easy one for you guys, but I’m not sure the best way to achieve it.

Is there some type of .erb I can write that asks “If :notice is present, then render…”?

Here’s more about the issue:

My controller specifies a :notice for both the create and update actions (pretty standard). When I load the pages, the notices do as I’d expect and show up. When I reload the page however, (not sure why someone would do this, but I did), the :notice goes away (great, that’s what I want), but the containing <div> remains.

How do I go about ensuring that the encapsulating <div> is removed along with the :notice? I’m not sure what conditionals to specify in my view or maybe controller. The view looks something like this (btw, I’m using Twitter Bootstrap JS alerts).

View

<div class="alert-message success fade in" data-alert="alert">
  <a class="close" href"#">×</a>
  <p><%= notice %></p>
</div>

My controller is a single scaffolded model/resource with basic structure

  • 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-26T23:39:01+00:00Added an answer on May 26, 2026 at 11:39 pm

    What I did was:

    <% if notice == "[:notice string]" %>
    .
    .
    .
    <% end %>
    

    Not sure if this is the most efficient and “Rails-y” way to do it, but it worked for me.

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

Sidebar

Related Questions

This might be an easy one, but I'm not really experienced with sql. I
This might be an easy one for some one but I haven't found a
Ok, this might be an easy one, im just not sure how to do
This might be easy but i am not sure about this as on beginner
This might seem an easy question for some, but I am struggling with it.
This might seem like a very easy question for some of you folks, but
I am hoping that there might be an easy way to do this, I
Ok, this might be an easy one, but I can't find a solution. I'm
I know this one might be easy but I couldn't figure out. I have
This might be a simple one, but I can't seem to find an easy

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.