Many-to-Many foreign key setup

I’m setting up a many-to-many as per
http://wiki.rubyonrails.org/rails/pages/ThroughAssociations
and just wanted to run this by others before going too far down this
path:

C:\code\strawr\db\migrate>
C:\code\strawr\db\migrate>
C:\code\strawr\db\migrate>svn info
Path: .
URL: https://strawr.googlecode.com/svn/trunk/db/migrate
Repository Root: https://strawr.googlecode.com/svn
Repository UUID: 37ac5c3a-a740-0410-be57-6ddc613217ac
Revision: 55
Node Kind: directory
Schedule: normal
Last Changed Author: hawat.thufir
Last Changed Rev: 55
Last Changed Date: 2007-12-11 18:59:18 -0800 (Tue, 11 Dec 2007)

C:\code\strawr\db\migrate>
C:\code\strawr\db\migrate>dir
Volume in drive C has no label.
Volume Serial Number is 0491-510F

Directory of C:\code\strawr\db\migrate

12/11/2007 07:00 PM .
12/11/2007 07:00 PM …
12/11/2007 07:00 PM 198 001_categories.rb
12/11/2007 07:00 PM 184 002_feeds.rb
12/11/2007 07:00 PM 245 003_category_feeds.rb
3 File(s) 627 bytes
2 Dir(s) 29,724,401,664 bytes free

C:\code\strawr\db\migrate>
C:\code\strawr\db\migrate>type 001_categories.rb
class Categories < ActiveRecord::Migration
def self.up
create_table :categories do |table|
table.column :category, string
end
end

    def self.down
            drop_table :categories
    end

end
C:\code\strawr\db\migrate>
C:\code\strawr\db\migrate>type 002_feeds.rb
class Feeds < ActiveRecord::Migration
def self.up
create_table :feeds do |table|
table.column :feed, :string
end
end

    def self.down
            drop_table :feeds
    end

end

C:\code\strawr\db\migrate>
C:\code\strawr\db\migrate>type 003_category_feeds.rb
class CategoryFeeds < ActiveRecord::Migration
def self.up
create_table :category_feeds do |table|
table.column :category_id, :integer
table.column :feed_id, :integer
end

def self.down
drop_table :category_feeds
end
end

C:\code\strawr\db\migrate>
C:\code\strawr\db\migrate>

thanks,

Thufir

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs