This project is archived and is in readonly mode.
Flash convenience methods "notice" and "alert" should also be available for FlashNow
Reported by Helmut Juskewycz | April 12th, 2010 @ 11:06 AM | in 3.0.2
Hi,
I guess the title describes it already pretty well. I think that for consistency, a FlashNow object should also have the same convenience methods as a Flash object has. In my mind a FlashNow object is the same as a Flash object, only that it isn't around for the next action, but has the same behavior.
So instead of
Flash.notice = "Saved"
Flash.now[:notice] = "Saved"
I can write
Flash.notice = "Saved"
Flash.now.notice = "Saved"
Comments and changes to this ticket
-
linki April 15th, 2010 @ 06:23 PM
- Tag changed from flash, rails3 to flash, patch, rails3
I like the idea and created a patch to add that behaviour.
I added:
flash.now.alert=(message)
flash.now.notice=(message)It's my first patch I ever created for the rails source, so if I did anything wrong, please tell me.
-
Rizwan Reza May 15th, 2010 @ 08:36 AM
- Milestone cleared.
- State changed from new to verified
- Assigned user set to Yehuda Katz (wycats)
+1 Applies cleanly.
-
Josh Kalderimis May 15th, 2010 @ 08:46 AM
+1 But could you make some tests for this linki, this makes sure the functionality stays consistent
-
Rizwan Reza May 15th, 2010 @ 10:21 AM
There are no tests for flash there from before, so I think this is good to go. Or may be we should go about adding tests for flash completely.
-
Rizwan Reza May 15th, 2010 @ 10:21 AM
- Tag changed from flash, patch, rails3 to bugmash, flash, patch, rails3
-
Rizwan Reza May 15th, 2010 @ 10:31 AM
- Assigned user changed from Yehuda Katz (wycats) to Rizwan Reza
-
Repository May 15th, 2010 @ 03:54 PM
- State changed from verified to resolved
(from [2d84f24af5cb0854a316929fa0d0720773be2162]) Add tests for convenience methods #notice and #alert to flash.now [#4369 state:resolved]
Signed-off-by: José Valim jose.valim@gmail.com
http://github.com/rails/rails/commit/2d84f24af5cb0854a316929fa0d072... -
Michael Raidel May 15th, 2010 @ 04:27 PM
just wanted to upload patch for ticket 4369 and recognized that there is already an applied patch. But the patch doesn't include all accessors from the original flash and is also a little unDRY so I am attaching my patch nevertheless.
-
Michael Raidel May 15th, 2010 @ 04:42 PM
I've attached a patch. This one only include the tests I wrote. Both tests essentially test the same thing.
-
José Valim May 15th, 2010 @ 04:59 PM
- State changed from resolved to open
- Assigned user changed from Rizwan Reza to José Valim
-
linki May 15th, 2010 @ 07:44 PM
Michael's code looks better but the question is do we need getters for "flash.now.notice" and "flash.now.alert"?
You'll never use "flash.now.notice" in any view, you only use "flash.notice" and either it survived the last request or it didn't depending on whether you set it through flash or flash.now
but it might be helpful in a controller..
-
José Valim May 15th, 2010 @ 08:14 PM
- State changed from open to resolved
@linki this is a good point! Let's leave as it is!
-
Jeremy Kemper October 15th, 2010 @ 11:01 PM
- Milestone set to 3.0.2
- Importance changed from to Low
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>
People watching this ticket
Attachments
Referenced by
- 4369 Flash convenience methods "notice" and "alert" should also be available for FlashNow (from [2d84f24af5cb0854a316929fa0d0720773be2162]) Add tes...