Here is my schema:
create_table :policies do |t|
t.string :name
t.timestamps
end
create_table :permissions do |t|
t.string :name
t.string :method
t.string :controller
t.timestamps
end
create_join_table :policies, :permissions do |t|
t.index :policy_id
t.index :permission_id
end
And here is the code I am using to create the records and their associations:
policy = Policy.create! name: "View All"
permission = Permission.create!({
name: "View Events",
method: "index",
controller: "Events"
})
policy.permissions << permission
And its returning the following error:
ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation "permission_policies" does not exist
The table name that was created through the migration is policies_permissions
I wonder if this is an issue with the class names not being inferred properly