Class: ActiveRecord::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/parole.rb

Direct Known Subclasses

Comment

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.acts_as_comment(*args) ⇒ Object



25
26
27
# File 'lib/parole.rb', line 25

def self.acts_as_comment(*args)
  include Parole::Comment
end

.acts_as_commentable(options = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/parole.rb', line 10

def self.acts_as_commentable(options = {})
  Parole.commentable_classes << self

  class_attribute :commentable_options, :actually_acts_as_commentable
  self.actually_acts_as_commentable = true
  self.commentable_options = options.reverse_merge(roles: [])
  self.commentable_options[:roles] = commentable_options[:roles].map(&:to_s)

  include Parole::Commentable
end

.acts_as_commentable?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/parole.rb', line 21

def self.acts_as_commentable?
  self.respond_to?(:actually_acts_as_commentable) && self.actually_acts_as_commentable
end

Instance Method Details

#commentable?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/parole.rb', line 29

def commentable?
  self.class.acts_as_commentable?
end