Sha256: f1c98450fcb7a0e7179936ab8723ba73df3256a86c3b6271324140ee04e259d9

Contents?: true

Size: 639 Bytes

Versions: 6

Compression:

Stored size: 639 Bytes

Contents

module ActiveRecord #:nodoc:
  class Base #:nodoc:
    class << self
      attr_accessor :disable_inheritance_instantiation

      private
      def instantiate_with_updateable_views_inheritance_support(attributes, column_types = {})
        object = instantiate_without_updateable_views_inheritance_support(attributes, column_types = {})
        if object.class.name == self.name || self.disable_inheritance_instantiation
          object
        else
          object.class.find(attributes.with_indifferent_access[:id])
        end
      end
      alias_method_chain :instantiate, :updateable_views_inheritance_support
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
updateable_views_inheritance-1.4.8 lib/updateable_views_inheritance/active_record.rb
updateable_views_inheritance-1.4.7 lib/updateable_views_inheritance/active_record.rb
updateable_views_inheritance-1.4.6 lib/updateable_views_inheritance/active_record.rb
updateable_views_inheritance-1.4.5 lib/updateable_views_inheritance/active_record.rb
updateable_views_inheritance-1.4.4 lib/updateable_views_inheritance/active_record.rb
updateable_views_inheritance-1.4.3 lib/updateable_views_inheritance/active_record.rb