Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 28th, 2012  |  syntax: None  |  size: 0.42 KB  |  hits: 29  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Rails 3 routing: include flash params with root redirect
  2. root :to => redirect("/dashboard")
  3.        
  4. root :to => redirect do |p, req|
  5.   req.flash.keep
  6.   "/dashboard"
  7. end
  8.        
  9. root :to => redirect { |p, req| req.flash.keep; "/dashboard" }
  10.        
  11. redirect_to root_url, :notice => "test flash notice"
  12.        
  13. <% if request.referer.scan('yoursitename').size == 0 %>
  14.  <%= create your own notice here %>
  15. <% end %>
  16.        
  17. redirect_to '/dashboard'