Class: KnowledgeBackup

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/knowledge_backup.rb

Class Method Summary collapse

Class Method Details

.new_comment_number_from_parent_document(parent_knowledge_id, user) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'app/models/knowledge_backup.rb', line 11

def new_comment_number_from_parent_document(parent_knowledge_id, user)
  comments = Knowledge.find(:all, :conditions => ["comment_on = ? AND comment_number IS NOT NULL", parent_knowledge_id], :user => user)
  if comments.length > 0
    comments.collect! {|comment|
      comment = comment.comment_number
    }
    comment_number = comments.max + 1
  else
    comment_number = 1
  end
end

.set_rgroups(*groups) ⇒ Object

copy of ./node.rb



24
25
26
27
# File 'app/models/knowledge_backup.rb', line 24

def set_rgroups(*groups)
  groups = groups[0] if groups.length==1 and groups[0].is_a?(Array)
  self.rgroups = Group.bit_mask_for(*groups)
end