Module: Opinio::OpinioSubjectum::ClassMethods

Defined in:
lib/opinio/opinio_subjectum.rb

Instance Method Summary collapse

Instance Method Details

#opinio_subjectum(*args) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/opinio/opinio_subjectum.rb', line 9

def opinio_subjectum(*args)
  options = args.extract_options!

  has_many :comments,
           :class_name => Opinio.model_name,
           :as => :commentable,
           :order => options.reverse_merge(:order => "created_at DESC")[:order],
           :dependent => :destroy


  send :include, Opinio::OpinioSubjectum::InstanceMethods
end