This project is archived and is in readonly mode.

#4911 ✓wontfix
PreciousBodilyFluids

[PATCH] Add :notice, :alert, and :flash as options to render.

Reported by PreciousBodilyFluids | June 20th, 2010 @ 08:01 AM

DHH added :notice, :alert and :flash as options to redirect_to, each of which set the flash hash before performing the redirect:

http://github.com/rails/rails/commit/e6cadd422b72ba9818cc2f3b22243a...

This patch gives the same options to render, setting values in flash.now. This gives the rendering/redirecting api some consistency. Tests are included, and everything passes on master.

Comments and changes to this ticket

  • José Valim

    José Valim June 21st, 2010 @ 10:16 AM

    • State changed from “new” to “wontfix”

    Thanks for your patch but tendering flash.now messages with a template is not a common pattern in most Rails applications. That said, I would prefer to leave the rendering stack simpler without need to check for extra flash keys.

  • Sean

    Sean July 15th, 2010 @ 05:52 PM

    • Importance changed from “” to “Low”

    Any chance of reconsidering? This may a worthy addition. Flashing notices while rendering is I believe not uncommon (since it usually mean recycling the page due to an error). It also adds consistency between redirect_to and render.

  • Adam

    Adam August 16th, 2010 @ 05:45 PM

    This is definitely a common pattern in most rails application I have authored or edited. I'll be stealing it for my personal use at very least. Thanks anyway. (PS, found this by googling knowing about the update to redirect_to).

  • PreciousBodilyFluids

    PreciousBodilyFluids August 16th, 2010 @ 05:50 PM

    Thanks, at least someone will get some use out of it.

  • Adam

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Attachments

Pages