Splitting the user into user and user_profile

Hi there,

I am totally new to Rails, so please forgive me that probably dumb question, but I am stuck with the constellation of having a user and a user_profile model.

The idea behind this is to have a user with only the user_id that has_many user_profiles and only the newest user_profile is active. This way I can keep track of all user data changes. But it also requires me to create a new user and a new user_profile in one step.

So... do you know a good starting point for doing this? I have set up the relationships and tried to work with

<% u.fields_for :user_profile do |p| %>   // profile fields here <% end %>

nested into the user's default creation form, but I do not know how to save it in my action (do I have to add something to my model too?).

So please, any help is welcome and I assure to ask better questions next time, lol :slight_smile:

Thanks in advance

Arne

Hi--

If you are versioning records, as in your UserProfile, then you may want to consider a plugin that does this for you. Consider this:

http://github.com/technoweenie/acts_as_versioned/tree/master

HTH, Nicholas