I have a Player model with some validations. I am using a partial form to create and update player info. I have the following like in the view <%= error_messages_for ''player'' %> On create the validation errors are correctly displayed, but if a validation error fails update, I get an ugly stack trace error that looks like this validation failed: Last name can''t be blank RAILS_ROOT: /home/maulin/projects/sports_ladder Application Trace | Framework Trace | Full Trace /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/validations.rb:1021:in `save_without_dirty!'' /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/dirty.rb:87:in `save_without_transactions!'' /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/transactions.rb:150:in `save!'' /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/database_statements.rb:66:in `transaction'' /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/transactions.rb:129:in `transaction'' /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/transactions.rb:138:in `transaction'' /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/transactions.rb:150:in `save!'' /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/transactions.rb:158:in `rollback_active_record_state!'' /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/transactions.rb:150:in `save!'' /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:2476:in `update_attributes!'' app/controllers/players_controller.rb:41:in `update'' why aren''t the validation erros being displayed nicely on update? -- 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 -~----------~----~----~----~------~----~------~--~---
> why aren''t the validation erros being displayed nicely on update?I was able to figure this out...If the record was not successfully audated because of a validation error, I needed to render :action => :edit. It now shows the errors nicely. -- 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 -~----------~----~----~----~------~----~------~--~---
I think this is a good example of how we should behave on a mailing list... too many people figure out an answer and never respond back :) Thanks On Tue, Feb 10, 2009 at 9:29 PM, Maulin pa <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > why aren''t the validation erros being displayed nicely on update? > > I was able to figure this out...If the record was not successfully > audated because of a validation error, I needed to render :action => > :edit. > > It now shows the errors nicely. > > -- > 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 -~----------~----~----~----~------~----~------~--~---