I want to simplify my Rails models, current looks like this:
class User < ActiveRecord::Base
has_many :offers, dependent: :destroy
has_many :reviews, dependent: :destroy
has_many :comments, dependent: :destroy
end
class Offer < ActiveRecord::Base
belongs_to :user
has_many :documents, as: :documentable
has_many :comments, dependent: :destroy
has_many :reviews, dependent: :destroy
end
class Review < ActiveRecord::Base
belongs_to :user
belongs_to :offer
end
class Comment < ActiveRecord::Base
belongs_to :user
belongs_to :offer
end
class Document < ActiveRecord::Base
belongs_to :documentable, polymorphic: true
end
As you can see, I have the same relations on Comment and Review models, but they have some difference in columns, what are the options do I have to minimize the amount of models?