Class: T_Class

Inherits:
Sequel::Model
  • Object
show all
Defined in:
model/tag.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.classes_documents(sr) ⇒ Object



48
49
50
# File 'model/tag.rb', line 48

def self.classes_documents(sr)
  T_Class.where(:systematic_review_id=>sr[:id], :type=>'document').or(:systematic_review_id=>sr[:id], :type=>'general')
end

Instance Method Details

#allocate_tag(tag) ⇒ Object



54
55
56
57
58
59
60
# File 'model/tag.rb', line 54

def allocate_tag(tag)
  tag_en_clase=TagInClass.where(:tag_id=>tag[:id],:tc_id=>self.id)
  if(tag_en_clase.empty?)
    TagInClass.insert(:tag_id=>tag[:id],:tc_id=>self.id)
  end

end

#deallocate_tag(tag) ⇒ Object



63
64
65
# File 'model/tag.rb', line 63

def deallocate_tag(tag)
  TagInClass.where(:tag_id=>tag[:id], :tc_id=>self.id).delete
end

#tagsObject



51
52
53
# File 'model/tag.rb', line 51

def tags
  Tag.join(:tag_in_classes, tag_id: :id ).select_all(:tags).where(:tc_id=>self.id)
end