Class methods added to the model that has been made acts_as_annotation_source (the mixin source type).
Helper finder to get all annotations for an object of the mixin source type with the ID provided. This is the same as object.annotations with the added benefit that the object doesnt have to be loaded. E.g: User.find_annotations_by(10) will give all annotations by User with ID 34.
# File lib/annotations/acts_as_annotation_source.rb, line 26 26: def annotations_by(id) 27: obj_type = ActiveRecord::Base.send(:class_name_of_active_record_descendant, self).to_s 28: 29: Annotation.find(:all, 30: :conditions => { :source_type => obj_type, 31: :source_id => id }, 32: :order => "created_at DESC") 33: end
Helper finder to get all annotations for all objects of the mixin source type, for the annotatable object provided. E.g: User.find_annotations_for(‘Book’, 28) will give all annotations made by all Users for Book with ID 28.
# File lib/annotations/acts_as_annotation_source.rb, line 37 37: def annotations_for(annotatable_type, annotatable_id) 38: obj_type = ActiveRecord::Base.send(:class_name_of_active_record_descendant, self).to_s 39: 40: Annotation.find(:all, 41: :conditions => { :source_type => obj_type, 42: :annotatable_type => annotatable_type, 43: :annotatable_id => annotatable_id }, 44: :order => "created_at DESC") 45: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.