module ErpBaseErpSvcs::Extensions::ActiveRecord::HasNotes::InstanceMethods
Public Instance Methods
add_note(note_type_iid, content, party=nil)
click to toggle source
adds note to model
# File lib/erp_base_erp_svcs/extensions/active_record/has_notes.rb, line 31 def add_note(note_type_iid, content, party=nil) note = Note.new note.note_type = NoteType.iid(note_type_iid) note.noted_record = self note.created_by = party unless party.nil? note.content = content note if note.save end
create_or_update_note_by_type(note_type_iid='basic_note', content='', party=nil)
click to toggle source
# File lib/erp_base_erp_svcs/extensions/active_record/has_notes.rb, line 40 def create_or_update_note_by_type(note_type_iid='basic_note', content='', party=nil) note = note_by_type(note_type_iid) if note.nil? note = Note.new if note.nil? note.note_type_id = NoteType.find_by_internal_identifier(note_type_iid).id note.noted_record = self note.created_by_id = party unless party.nil? end note.content = content note.save end
note_by_type(note_type_iid)
click to toggle source
# File lib/erp_base_erp_svcs/extensions/active_record/has_notes.rb, line 52 def note_by_type(note_type_iid) note_type = NoteType.find_by_internal_identifier(note_type_iid) notes.where(:note_type_id => note_type.id).first end
notes_by_type(note_type_iid)
click to toggle source
# File lib/erp_base_erp_svcs/extensions/active_record/has_notes.rb, line 57 def notes_by_type(note_type_iid) note_type = NoteType.find_by_internal_identifier(note_type_iid) notes.where(:note_type_id => note_type.id) end