3 ms·
Exactly. Something like this: if @foo.save flash[:success] = "Saved" redirect_to foos_path else redirect_to new_foo_path end The
by pjungwir 11y ago
Exactly. Something like this:
if @foo.save
flash[:success] = "Saved"
redirect_to foos_path
else
redirect_to new_foo_path
end
The standard pattern is to `render 'new'` rather than doing the latter redirect. So I'm complaining that my preferred way isn't "blessed" by the Rails community. Also you need a trick to keep @foo.errors in between requests and load it up in your #new method the second time around.