record.save returns false

Using the console, I capture a db record into the variable 'record'.
I then try to save it with the record.save method which returns
false. There is nothing in the log files to indicate why the save
failed. Can anyone please tell me what I might investigate to
determine why the save fails? A transcript of my console session is
shown below. Thanks for any input.

        ... doug

record=Member.find(1)

=> #<Member id: 1, login: "Mask", password: "Mask", flags: 0,
first_name: "OK", last_name: "OK", email: "_OK", courtesy_title: "OK",
created_at: nil, updated_at: nil, double_opt_in: nil, street: nil,
street2: nil, suite: nil, city: nil, region: nil, postal_code: nil,
country: nil, home_phone: nil, business_phone: nil, mobile_phone: nil,
fax: nil, custom0: nil, custom1: nil, custom2: nil, custom3: nil,
custom4: nil, custom5: "Meal_Preference", custom6: nil, custom7: nil,
custom8: nil, custom9: nil>

record.save

=> false

Try record.save! so it throws an error that you can look at.

Or examine record.errors for validation failures.

Also consider adding the following to your ~/.irbrc file. This will output all logging to the screen and you can look at the SQL query itself.

Hi Doug,

You can check the validation errors after the save to figure out if the validations caused the failed save…

record = Member.find(1)

record.save

record.errors.full_messages.inspect

Cheers,

Jits

Hi Doug,

You can check the validation errors after the save to figure out if the
validations caused the failed save...

Also check if you have a before_save callback that might be stopping
the save

Fred

You can check the validation errors after the save to figure out if the
validations caused the failed save...

Fred, you're absolutely right. It was a validation issue that caused
the failed save. I had already figured that out using the techniques
offered by the other 2 contributors. All is well and I am a happy
camper. Thanks to all for the very helpful input.

           ... doug