I have a couple of models which share a has_many associations, named scopes and validations.
What s the best way of drying these models up so they can share the same code?
Create a parent class and have these models inherit from that or would I be better off creating a module?
This is the type of code I m looking to dry up:
has_many :comments, :as => :commentable
has_permalink :title
validates_presence_of :title
has_attached_file :image
I ve already figured that I can use this in a module to handle the has_many associations but when I try something similar with has_permalink or has_attached_file then things break down.
def self.included(klass)
klass.has_many :comments, :as => :commentable
end