I'm using <http://wiki.rubyonrails.org/rails/pages/ThroughAssociations> as a guide, but it doesn't say how to generate the model for the join table. Which of the following would be preferable:
script/generate scaffold category_feeds
or
script/generate model category_feeds
So long as it's kosher, I prefer the scaffold generator. For now the join table only has foreign keys for fields, but that may change down the road.
thufir@arrakis ~/Desktop/strawr/app/models $ thufir@arrakis ~/Desktop/strawr/app/models $ ll total 8 -rw-r--r-- 1 thufir users 66 Dec 12 02:40 category.rb -rw-r--r-- 1 thufir users 61 Dec 12 02:41 feed.rb thufir@arrakis ~/Desktop/strawr/app/models $ thufir@arrakis ~/Desktop/strawr/app/models $ cat category.rb class Category < ActiveRecord::Base has_many : CategoryFeeds end thufir@arrakis ~/Desktop/strawr/app/models $ thufir@arrakis ~/Desktop/strawr/app/models $ cat feed.rb class Feed < ActiveRecord::Base has_many :CategoryFeeds end thufir@arrakis ~/Desktop/strawr/app/models $ thufir@arrakis ~/Desktop/strawr/app/models $ ll /home/thufir/Desktop/ strawr/db/migrate/ total 12 -rw-r--r-- 1 thufir users 199 Dec 12 02:32 001_categories.rb -rw-r--r-- 1 thufir users 184 Dec 12 02:32 002_feeds.rb -rw-r--r-- 1 thufir users 251 Dec 12 02:32 003_category_feeds.rb thufir@arrakis ~/Desktop/strawr/app/models $ thufir@arrakis ~/Desktop/strawr/app/models $ cat /home/thufir/Desktop/ strawr/db/migrate/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 end
def self.down drop_table :category_feeds end end thufir@arrakis ~/Desktop/strawr/app/models $
thanks,
Thufir