Module: IFlash
- Defined in:
- lib/i_flash.rb
Instance Method Summary collapse
- #i_flash(result = :notice, *args) ⇒ Object
- #i_flash_auto(result = :notice, *args) ⇒ Object
- #i_flash_for(condition = true, *args) ⇒ Object
Instance Method Details
#i_flash(result = :notice, *args) ⇒ Object
9 10 11 12 |
# File 'lib/i_flash.rb', line 9 def i_flash(result = :notice, *args) i_path = "actions.#{params[:controller]}.#{params[:action]}.#{result.to_s}" flash[(result)] = t(i_path, *args) end |
#i_flash_auto(result = :notice, *args) ⇒ Object
3 4 5 6 7 |
# File 'lib/i_flash.rb', line 3 def i_flash_auto(result = :notice, *args) i_path = "actions.all.#{params[:action]}.#{result.to_s}" object = params[:controller].singularize.titlecase flash[(result)] = t(i_path, :object => object) end |
#i_flash_for(condition = true, *args) ⇒ Object
14 15 16 |
# File 'lib/i_flash.rb', line 14 def i_flash_for(condition = true, *args) condition ? i_flash(:success, *args) : i_flash(:failure, *args) end |