Topic: Model Setup Questions

Hello Everyone,

I am a relatively new Rails programmer coming over from the PHP world and had a couple questions as I work on my first application.

First, suppose that I have a User model and a Calendar model. I want every Calendar to belongs_to a User, but not every User to necessarily have a Calendar. So, for that relationship, am I correct in just having a one-way belongs_to relationship with the user_id in the Calendar model and nothing in the User model? Or is there a better way to do it?

Second, when creating a User model with a Profile, is it best to have a single User model or a separate model with Profile fields (such as a bio and phone number)? When you see deployed apps, is the

Re: Model Setup Questions

I think that your question got cut off - what was the end of it?

Regarding User models and profiles, I would just put those fields into the User model, unless for some reason a User could have multiple profiles.  But if it's a 1-to-1 relationship, then I would just put them in the User model.