I'm having a problem with a habtm association. I'm not sure if I set
them up wrong or if I'm trying to work with the models incorrectly.
Either way I welcome any clarification on why this isn't working.
My models look like this:
model/user.rb
I'm having a problem with a habtm association. I'm not sure if I set
them up wrong or if I'm trying to work with the models incorrectly.
Either way I welcome any clarification on why this isn't working.
My models look like this:
model/user.rb
Is there a reason that you have
t.column :id, :number
in the roles_users table?
i've been trying a number of things. i originally had no "id" columns
defined because i didn't think you needed to create them manually.
Hi Mike. I think you want this:
class CreateRolesUsers < ActiveRecord::Migration
def self.up
create_table :roles_users, :id => false do |t|
t.column :role_id, :integer
t.column :user_id, :integer
end
end
Essentially, you don't want to allow ActiveRecord to give your join
tables an id field which is a primary key. For more information, see
my post here: