Module: Commentable

Defined Under Namespace

Modules: CommentableInstance

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/commentable.rb', line 3

def self.included(base)
  base.class_eval do
    has_one :comment, :as => :commentable, :dependent => :destroy
    accepts_nested_attributes_for :comment, :allow_destroy => true,
      :reject_if => proc { |attrs| attrs['text'].blank? }
    include CommentableInstance
  end
end