has_one update problem

Posted by Kalyan M on Stack Overflow See other posts from Stack Overflow or by Kalyan M
Published on 2010-05-10T16:22:36Z Indexed on 2010/05/10 16:24 UTC
Read the original article Hit count: 256

I have two models, User and Account. Each user may have one account.

Creating an account for a user works fine. My problem is that when I try to update the account, the previous accounts user_id is nullified and a new account row is created with the user_id. I do not want this happening. I want to update the existing row with the changes to account. How do I do this?

Thanks.

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about has-one