Sha256: 876283a2ed6c7b758b92c7967c4a60549af589ea5f01d497ebec5ca27a5a2d34
Contents?: true
Size: 1.04 KB
Versions: 5
Compression:
Stored size: 1.04 KB
Contents
module ErpBaseErpSvcs module Extensions module ActiveRecord module ActsAsNoteType def self.included(base) base.extend(ClassMethods) end module ClassMethods def acts_as_note_type extend ActsAsNoteType::SingletonMethods include ActsAsNoteType::InstanceMethods after_initialize :initialize_note_type after_create :save_note_type after_update :save_note_type after_destroy :destroy_note_type has_one :note_type_record, :as => :note_type_record, :class_name => 'NoteType' end end module SingletonMethods end module InstanceMethods def save_note_type self.note_type_record.save end def destroy_note_type self.note_type_record.destroy end def initialize_note_type if (self.note_type_record.nil?) note_type_record = NoteType.new self.note_type_record = note_type_record self.note_type_record.note_type_record = self end end end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems