2

Rails 3 has a nice feature to save writing flashes on a separate line:

redirect_to @product, :notice => "Successfully created product."

It would be great with respond_with, but not supported. Any way to override respond_with to take an optional flash hash?

mahemoff
  • 44,526
  • 36
  • 160
  • 222
  • `respond_with` made so because it will output on different types of content. For example, what form should have flash message in XML or JSON formats? Also, you could use `render` and `redirect_to` inside `respond_with` block. See [docs](http://apidock.com/rails/ActionController/MimeResponds/respond_with). – Mark Huk Dec 23 '11 at 12:49
  • 1
    I have a custom after_filter which puts the flash in a response header (that can be rendered in response to XHR). – mahemoff Dec 23 '11 at 13:18
  • see also http://stackoverflow.com/a/6205403/683157 – kuboon May 28 '13 at 03:31

0 Answers0