Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

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

#4911

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.

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

State: wontfix
Milestone: none
Assigned to: nobody
Importance: Low

Activity

  1. José Valim
    José Valim
    • 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.

    June 21st, 2010 @ 10:16 AM

  2. Sean
    Sean
    • 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.

    July 15th, 2010 @ 05:52 PM

  3. Adam
    Adam

    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).

    August 16th, 2010 @ 05:45 PM

  4. PreciousBodilyFluids
    PreciousBodilyFluids

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

    August 16th, 2010 @ 05:50 PM

  5. Adam