Module: Mongoid::Publishable::ClassMethods

Defined in:
lib/mongoid/publishable.rb

Instance Method Summary collapse

Instance Method Details

#publisher_column(name = nil) ⇒ Object

gets/sets the column that stores the user_id



20
21
22
23
# File 'lib/mongoid/publishable.rb', line 20

def publisher_column(name = nil)
  @publisher_column = name if name
  @publisher_column || :user_id
end

#publisher_foreign_key(name = nil) ⇒ Object

gets/sets the foreign key of the publisher to be stored



26
27
28
29
# File 'lib/mongoid/publishable.rb', line 26

def publisher_foreign_key(name = nil)
  @publisher_foreign_key = name if name
  @publisher_foreign_key || :id
end

#publishing_conditions(&block) ⇒ Object

gets/sets custom publishing conditions



32
33
34
35
36
37
38
# File 'lib/mongoid/publishable.rb', line 32

def publishing_conditions(&block)
  if block_given?
    @publishing_conditions = block
  else
    @publishing_conditions
  end
end