# Has\_many Question

**URL:** <https://www.ruby-forum.com/t/has-many-question/137283>\
**Category:** Rails\
**Created:** [May 11, 2008, 11:54am UTC](https://www.ruby-forum.com/t/has-many-question/137283 "2008-05-11T11:54:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![GabrielG1976](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8491ac/32.png) [@GabrielG1976](https://www.ruby-forum.com/u/GabrielG1976)\
**Post date:** [May 11, 2008, 11:54am UTC](https://www.ruby-forum.com/t/has-many-question/137283/1 "2008-05-11T11:54:40Z")

</div>

trying to added user accounts to a blog i have the user accounts  
created just want to associate it with blog

---

<div class="post-metadata">

**Author:** ![GabrielG1976](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8491ac/32.png) [@GabrielG1976](https://www.ruby-forum.com/u/GabrielG1976)\
**Post date:** [May 12, 2008, 1:55am UTC](https://www.ruby-forum.com/t/has-many-question/137283/2 "2008-05-12T01:55:48Z")

</div>

GabrielG1976 wrote:

> trying to added user accounts to a blog i have the user accounts  
> created just want to associate it with blog

so a user owns a blog?

you need to add a migration to add a :user\_id column to Blog.

now;

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

class User \< ActiveRecord::Base  
has\_many :blogs  
end
