On 30 September 2011 05:49, Rob Biedenharn <[email protected]> wrote: > class File > has_many :admins > has_many :users, :through => :admins > end > class Admin > belongs_to :file > belongs_to :user > end > class User > end > You should not need an `id` on the admins table, but you almost certainly > want to have an index on each of the `file_id` and `user_id` columns.
Are you sure? I've not got time to test it right now, but I was under the impression you would need an id for the admins table unless the model described it as the join table in a habtm? class File has_and_belongs_to_many :users, :join_table => "admins" end class User has_and_belongs_to_many :files, :join_table => "admins" end File.first.users etc -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

