Does the new Restful features of Edge support form validation? I have "validates_presence_of :x" in my model, but rails spills it''s beans with and error: "ActiveRecord::RecordInvalid" What I''d it to do is return the form with the usual fieldWithErrors divs Has anyone got this working? thanks :) Jason --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Jason B wrote:> Does the new Restful features of Edge support form validation? > > I have "validates_presence_of :x" in my model, but rails spills it''s > beans with and error: "ActiveRecord::RecordInvalid" > > What I''d it to do is return the form with the usual fieldWithErrors divs > > Has anyone got this working? > > thanks :) Jasonthe validates_presence_of :x will raise an ActiveRecord::RecordInvalid exception if :x is not presence. You would have to catch the exception. For example: def test begin s = SomeRecord.new s.save redirect_back_or_default(:action => ''done'') rescue ActiveRecord::RecordInvalid render :action => ''test'' end end -- 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?hl=en -~----------~----~----~----~------~----~------~--~---