I have a form that posts back to itself (form action = current browser URL), and the validations work properly. I use a little code to determine whether they''ve entered information, so if they leave and come back they don''t have to refill out the form: # Create new order or get from session if session[:order].nil? @order = Order.new session[:order] = @order else @order = session[:order] end but now, if they just visit the page (issuing a GET statement), the page thinks there are errors and shows the error box. Is there a way to skip error validation for a GET statement? Like: # don''t show model errors if request.get? # some magic line to skip model validation End Thanks, Chad --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
case @request.method when :post ...etc... when :get ...etc... end harp -- 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 post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
it''s the ...etc... under your "when :get" that I''m looking for... thanks though --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Try for your magic code: if session[:order].nil? @order = Order.new session[:order] = @order else @order = session[:order].send :instance_variable_set, :@attributes, session[:order].attributes_before_type_cast end The problem (probably) is you''re storing validation errors in the session too. Let me know if this works, Vish On 9/25/06, Chad <carimura-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > > it''s the ...etc... under your "when :get" that I''m looking for... > > thanks though > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Thank you Vish, that pointed me in the right direction... Yes, I was storing the errors in the session. For now, I''ll just do a "session[:order].errors.clear" in the appropriate place... I will fine tune later. Thanks again, Chad --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---