has_and_belongs_to_many , . , . :
class Album < ActiveRecord::Base
has_and_belongs_to_many :photographs
class Photograph < ActiveRecord::Base
has_and_belongs_to_many :albums
:
class AlbumPhotographJoinTable < ActiveRecord::Migration
def self.up
create_table :albums_photographs, :id => false do |t|
t.integer :album_id
t.integer :photograph_id
end
end
def self.down
drop_table :albums_photographs
end
end
, .