Hi, I have the next models:
create_table :categories do |t|
t.integer :category_id
t.integer :language_id
t.timestamps
end
create_table :category_localizated_categories, :force => true do |t|
t.column :category_id, :integer
t.column :localizated_category_id, :integer
end
class Category < ActiveRecord::Base
has_many :category_localizated_categories
has_many :localizated_categories, :through => :category_localizated_categories
end
class CategoryLocalizatedCategory < ActiveRecord::Base
belongs_to :category
belongs_to :localizated_category
end
I can do:
category1 = Category.create :language_id => 1
category2 = category1.localizated_categories.create :language_id => 2
And 2 categories are created in DB, but the association is not created:
category.localizated_categories
[]
What could be the problem? Thanks.