Ruby on Rails
Saturday, March 2, 2013
render the view - @question will be given to the view for rendering the previous values
render :new if @question.errors.any?
On Sat, Mar 2, 2013 at 12:23 PM, Dave Castellano <lists@ruby-forum.com> wrote:
Thank you everyone for the previous validation help. I have one last
question... Can anyone tell me if there is a standard way to deal with a
failed
validation and loss of the data that was partially completed on the
form. I currently use a redirect back to the same action and lose all
the data (obviously). Do I send valid data back and forth in the
params hash?
if @question.errors.any?
redirect_to(:controller => "questions", :action => "new",
:minisection_id => session[:minisection_id], :question_type =>
"standard")
There has to be a standard way to do this I assume...
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment