simo
simo

Reputation: 24560

Rails 3, why model update fails silently ? how to debug DB?

I have added new fields for my devise user, but, now, I can't update the student record, although I get the message:

You updated your account successfully.

But, the DB is never updated!

The new fields have attr_accessible and attr_accessor

Is it because there is a foreign keys in the new fields ? I have added country id to associate the user with his country, is this a reason for not updating ?

How can I debug the DB error occurred ? I tried to use update_attributes! in the devise function: update_with_password, but, no luck, no errors, just: You updated your account successfully.

I've noticed that there is no SQLite UPDATE command issued at Server Development log, why ?

Any help please ?

Upvotes: 1

Views: 551

Answers (2)

simo
simo

Reputation: 24560

I found the solution, I should not use attr_accessor as its for those attributes that are not stored directly into DB.

I hope this will help some one.

Upvotes: 1

jake
jake

Reputation: 2411

Try raising a exception or logging by adding an after_filter to your update action on the UserController. Try overriding the controller action (and call super) if you dont have a hook to that code.

Upvotes: 0

Related Questions