Obecnie rozwijam silnik do montażu. W silniku Mam następujące dwa modele:Tabele łącza HABTM nie pobierają wartości izolatora w zamontowanym silniku
module Ems
class Channel < ActiveRecord::Base
has_and_belongs_to_many :categories
end
end
module Ems
class Category < ActiveRecord::Base
has_and_belongs_to_many :channels
end
end
Są to pliki migracji db:
class CreateEmsChannels < ActiveRecord::Migration
def change
create_table :ems_channels do |t|
t.string :slug
t.string :name
t.timestamps
end
end
end
class CreateEmsCategories < ActiveRecord::Migration
def change
create_table :ems_categories do |t|
t.string :slug
t.string :name
t.text :strapline
t.timestamps
end
end
end
class CreateEmsCategoriesChannels < ActiveRecord::Migration
def up
# Create the association table
create_table :ems_categories_channels, :id => false do |t|
t.integer :category_id, :null => false
t.integer :channel_id, :null => false
end
# Add table index
add_index :ems_categories_channels, [:category_id, :channel_id], :unique => true
end
end
Problem zaczyna się, gdy próbuję odzyskać przynależne obiektów. Jako przykład, gdy zgłoszę @channel.get :categories
pojawia się następujący błąd:
Mysql2::Error: Table 'ems_development.categories_channels' doesn't exist:
SELECT `ems_categories`.*
FROM `ems_categories`
INNER JOIN `categories_channels`
ON `ems_categories`.`id` = `categories_channels`.`category_id`
WHERE `categories_channels`.`channel_id` = 1
Jak widać jej brakuje off wartość isolate_namespace na stole łącza, jak powinno wyglądać dla stowarzyszenia na stole ems_categories_channels
nie categories_channels
Ktoś miał podobne problemy lub czegoś brakuje?
Nie widzę, czy twój silnik zawiera "izolat_namespace", czy nie? moduł Ems klasa silnika