I have several such models:
class Alpha < ActiveRecord::Base
has_many :items
end
class Beta < ActiveRecord::Base
has_many :items
end
class Item < ActiveRecord::Base
belongs_to :alpha
belongs_to :beta
end
But I want the model of the element in each database entry to belong to either the alpha or beta, but not both. Any good way to do this in Rails 3? or should I simulate it using AlphaItems and BetaItems?
source
share