Sha256: 211ae02d07cf9f6cdaa93861f3654fd1147babfe86b83b846ad1c7c8741753ea
Contents?: true
Size: 1.06 KB
Versions: 11
Compression:
Stored size: 1.06 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.new_record? and 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
11 entries across 11 versions & 1 rubygems