# Join model misery

**URL:** <https://www.ruby-forum.com/t/join-model-misery/149607>\
**Category:** Rails\
**Created:** [September 26, 2008, 6:22pm UTC](https://www.ruby-forum.com/t/join-model-misery/149607 "2008-09-26T18:22:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rick\_2047](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ecd19e/32.png) [@rick\_2047](https://www.ruby-forum.com/u/rick_2047)\
**Post date:** [September 26, 2008, 6:22pm UTC](https://www.ruby-forum.com/t/join-model-misery/149607/1 "2008-09-26T18:22:36Z")

</div>

I have two models Event and Category in my rails app.  
I want a join model for many to many association so i used the script

./script/generate migration create\_categories\_events event\_id:integer  
category\_id:integer

but the migration that is generated is empty. I am using rails 2.1.1.  
Can anyone tell me whats the problem here

---

<div class="post-metadata">

**Author:** ![rick\_2047](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ecd19e/32.png) [@rick\_2047](https://www.ruby-forum.com/u/rick_2047)\
**Post date:** [September 26, 2008, 6:23pm UTC](https://www.ruby-forum.com/t/join-model-misery/149607/2 "2008-09-26T18:23:11Z")

</div>

On Sep 26, 5:05 pm, rick\_2047 [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I have two models Event and Category in my rails app.  
> I want a join model for many to many association so i used the script
> 
> ./script/generate migration create\_categories\_events event\_id:integer  
> category\_id:integer
> 
> but the migration that is generated is empty. I am using rails 2.1.1.  
> Can anyone tell me whats the problem here

Because that generator doesn’t try and fill in the migration for you  
(script/generate model would). More details here:

> **[rails.info](http://guides.rails.info/migrations/migrations.html#_creating_a_migration)**
>
> Ruby on Rails,Rails Tutorial,Ruby Basics,Rails 4,Bar Rails,Rail

Fred

---

<div class="post-metadata">

**Author:** ![rick\_2047](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ecd19e/32.png) [@rick\_2047](https://www.ruby-forum.com/u/rick_2047)\
**Post date:** [September 26, 2008, 8:04pm UTC](https://www.ruby-forum.com/t/join-model-misery/149607/3 "2008-09-26T20:04:34Z")

</div>

So what do you suggest i should do create the join table with the model  
of  
hand fill it.

On Fri, Sep 26, 2008 at 9:22 AM, Frederick C. \<  
removed\_email\_address@domain.invalid\> wrote:

> > but the migration that is generated is empty. I am using rails 2.1.1.  
> > Can anyone tell me whats the problem here
> 
> Because that generator doesn’t try and fill in the migration for you  
> (script/generate model would). More details here:  
> [rails.info](http://guides.rails.info/migrations/migrations.html#_creating_a_migration)
> 
> Fred
> 
> >

–  
**I believe in beautiful ideas,**

 

**Most of my ideas are of girls.**
