Sha256: 9221e2f6a0ed4b3d12675c2d2225de7c336f6aa931ec0a965a9e7523307ed781

Contents?: true

Size: 749 Bytes

Versions: 3

Compression:

Stored size: 749 Bytes

Contents

module DBViewCTI
  module Model
    module CTI
      module Destroy
        extend ActiveSupport::Concern

        # change destroy and delete methods to operate on most specialized object
        included do
          alias_method_chain :destroy, :cti
          alias_method_chain :delete, :cti
          # destroy! seems te be defined in Rails 4
          alias_method_chain :destroy!, :cti if self.method_defined?(:destroy!)
        end
        
        def destroy_with_cti
          specialize.destroy_without_cti
        end
        
        def destroy_with_cti!
          specialize.destroy_without_cti!
        end
        
        def delete_with_cti
          specialize.delete_without_cti
        end
        
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dbview_cti-0.2.1 lib/db_view_cti/model/cti/destroy.rb
dbview_cti-0.2.0 lib/db_view_cti/model/cti/destroy.rb
dbview_cti-0.1.5 lib/db_view_cti/model/cti/destroy.rb