Search code examples
ruby-on-rails-3activerecordmodel-associations

Should I use separate models for Users and Profiles in Ruby on Rails 3 for the associations?


At first I had in mind just a User model for the authentication on my application but then i Decided to give this users a profile so I created the Profile model, now:

User has_one :profile

and

Profile belongs_to :user

Is this correct or should I just keep one model, let's say User, and keep there all the fields corresponding to profile and delete the Profile model?

Thanks.

== Update

This are the attributes of User and Profile Models.

User

  • username
  • password

Profile

  • name
  • last_name
  • email
  • website
  • picture
  • about

Solution

  • Having the user model with the authentication attribute and the profile with the specific and personal information is alright.

    There is not "right" way.

    I think this one is ok.