# UserEngine + User Profiles

**URL:** <https://www.ruby-forum.com/t/userengine-user-profiles/59128>\
**Category:** Engines\
**Created:** [April 28, 2006, 10:20pm UTC](https://www.ruby-forum.com/t/userengine-user-profiles/59128 "2006-04-28T22:20:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rays](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/7ab992/32.png) [@rays](https://www.ruby-forum.com/u/rays)\
**Post date:** [April 28, 2006, 10:20pm UTC](https://www.ruby-forum.com/t/userengine-user-profiles/59128/1 "2006-04-28T22:20:18Z")

</div>

I’m taking a new approach to how I view user data, I think in the end it  
will be faster for the system anyways… What I’m doing is using  
LoginEngine/UserEngine combo on my site for authorization, and I want  
each user to have a profile that they edit and maintain. Each user  
would have 1 profile.

My question is getting my profile and my user account to have a  
relationship. I have in my Profile model:

class Profile \< ActiveRecord::Base  
has\_one :user  
end

In my user.rb - I’m editing the user\_engines/app/,odel/user.rb directly  
for now:

class User \< ActiveRecord::Base  
include LoginEngine::AuthenticatedUser  
include UserEngine::AuthorizedUser

belongs\_to :profile

In my profiles database I have a user\_id field that is of type int(11).  
What I was expecting to happen (and this is obviously me being a newbie)  
is that when I enter in a new profile the user\_id field would  
automagically be filled in by the relationship. Can anyone give me a  
hand getting this going?

---

<div class="post-metadata">

**Author:** ![rays](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/7ab992/32.png) [@rays](https://www.ruby-forum.com/u/rays)\
**Post date:** [May 3, 2006, 6:56pm UTC](https://www.ruby-forum.com/t/userengine-user-profiles/59128/2 "2006-05-03T18:56:36Z")

</div>

On 28 Apr 2006, at 21:20, Ray Slakinski wrote:

> class User \< ActiveRecord::Base  
> include LoginEngine::AuthenticatedUser  
> include UserEngine::AuthorizedUser
> 
> belongs\_to :profile

A user doesn’t belong to a profile. A profile belongs to a user.

class User \< ActiveRecord::Base  
has\_one :profile  
end

class Profile \< ActiveRecord::Base  
belongs\_to :user  
end

And then things will act as you expect.

–  
Paul R.
