Knowing when to use flash.now
The flash hash is designed to carry a message from one action to the next. Here’s a simple example:
The flash hash is designed to carry a message from one action to the next. Here’s a simple example:
One of the fundamental principles in Ruby is DRY: Don’t Repeat Yourself; which makes sense. Why waste time and effort re-writing code when you can simply reuse code you’ve already written? It also means if you ever need to change your code, you only have to change it in one...
In tip #3 I showed a quick javascript tip to hide your flash messages after a time delay. This technique may not be suitable for every application however; hiding feedback messages too quickly may make your site less accessible, especially to users who are visually impaired.
When working with rails, the Rails Framework Documentation and Ruby Documentation are invaluable resources.
Here are some handy rake tasks you may not be aware of and a quick description of what they do: