Sha256: 4a9972a7dbdb26f585ca7b90e49743ae4f4892147ea437031ce34541b20de49c

Contents?: true

Size: 702 Bytes

Versions: 2

Compression:

Stored size: 702 Bytes

Contents

module ActsAsComment
	module ClassMethods
    # Allows one to customize the default settings. Accepts the following options hash:
  	# * *commentable_label* - The commentable (parent object) label method. Optional. Defaults to: label.
  	# * *comment_label* - The comment label method. Optional. Defaults to: label.
		def acts_as_comment options = {}
      write_inheritable_attribute :acts_as_comment_options, options
      class_inheritable_reader :acts_as_comment_options
			belongs_to :commentable, :polymorphic => true
		end
	end
end

module ActsAsCommentable
	module ClassMethods
    def acts_as_commentable
      has_many :comments, :as => :commentable, :dependent => :destroy
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aeonscope-acts_as_commentable-1.0.0 lib/class_methods.rb
aeonscope-acts_as_commentable-1.1.0 lib/class_methods.rb