Module: ErpBaseErpSvcs::Extensions::ActiveRecord::HasNotes::ClassMethods

Defined in:
lib/erp_base_erp_svcs/extensions/active_record/has_notes.rb

Instance Method Summary collapse

Instance Method Details

#has_notesObject



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/erp_base_erp_svcs/extensions/active_record/has_notes.rb', line 10

def has_notes

      has_many :notes, :as => :noted_record, :dependent => :delete_all do
        def by_type(note_type_iid)
          where('note_type_id = ?', NoteType.iid(note_type_iid))
        end

      end
					
      extend SingletonMethods
      include InstanceMethods

end