Re: Strange Record not saved errors

Ivor Paul
Mon, 26 Mar 2007 10:39:56 -0000

this looks like it happens when you try to sign up a new user. does it
happen with other actions aswell or is it specific to signup?

What does your controller function for signup look like and can you post the
user model?
In my user model I have these validations that could be causes problems for
you if they are present in your model.

  validates_presence_of     :login, :email
  validates_presence_of     :password,                   :if =>
:password_required?
  validates_presence_of     :password_confirmation,      :if =>
:password_required?
  validates_length_of       :password, :within => 4..40, :if =>
:password_required?
  validates_confirmation_of :password,                   :if =>
:password_required?
  validates_length_of       :login,    :within => 3..40
  validates_length_of       :email,    :within => 3..100
  validates_uniqueness_of   :login, :email, :case_sensitive => false
  before_save :encrypt_password

Regards
Ivor

On 3/26/07, jeroen <jeroen-5fGJ/kX/fGk@public.gmane.org>
wrote:
>
>
> I have a site with an acts_as_authenticated based login which has
> started throwing up some strange errors. Until a few days ago
> everything worked fine but all of a sudden
''RecordNotSaved'' errors are
> popping up in my logs.
>
> When I check the database, it looks like the record _is_ saved but I
> think users get an error so I''m starting to see a lot of
double/triple
> entries for the same user. It doesn''t happen all the time and I
can''t
> really reproduce it myself and the log entry is not very helpful so I
> have no idea how to solve this.. I am not even sure which direction to
> look.. could it be related to mysql performance errors or something?
>
> This is the error I''m getting:
>
> A ActiveRecord::RecordNotSaved occurred in account#signup:
>
>   ActiveRecord::RecordNotSaved
>   [RAILS_ROOT]/vendor/rails/activerecord/lib/active_record/base.rb:
> 1398:in `save_without_validation!''
>
>
> >
>