Sha256: 0cfb3c5c77e7513c0abb21f2e9455502644ee62099be4a8ac830d61fd22b6f49

Contents?: true

Size: 1.29 KB

Versions: 13

Compression:

Stored size: 1.29 KB

Contents

module RailsSqlViews
  module ConnectionAdapters
    module AbstractAdapter
      def self.included(base)
        base.alias_method_chain :disable_referential_integrity, :views_excluded
      end

      # Subclasses should override and return true if they support views.
      def supports_views?
        return false
      end

      # Subclasses should override and return false if they don't support CASCADE
      def supports_drop_table_cascade?
        return true
      end
      
      def disable_referential_integrity_with_views_excluded(&block)
        self.class.send(:alias_method, :original_tables_method, :tables)
        self.class.send(:alias_method, :tables, :base_tables)
        disable_referential_integrity_without_views_excluded(&block)
      ensure
        self.class.send(:alias_method, :tables, :original_tables_method)
      end
      
      def supports_view_columns_definition?
        true
      end
      
      # Get a list of all views for the current database
      def views(name = nil)
        raise NotImplementedError, "views is an abstract method"
      end
      
      # Get the select statement for the specified view
      def view_select_statement(view, name=nil)
        raise NotImplementedError, "view_select_statement is an abstract method"
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 5 rubygems

Version Path
robdimarco_rails_sql_views-0.9.0 lib/rails_sql_views/connection_adapters/abstract_adapter.rb
qubole_rails_sql_views-0.10.0 lib/rails_sql_views/connection_adapters/abstract_adapter.rb
mereghost-rails_sql_views-0.8.3 lib/rails_sql_views/connection_adapters/abstract_adapter.rb
mereghost-rails_sql_views-0.8.2 lib/rails_sql_views/connection_adapters/abstract_adapter.rb
mereghost-rails_sql_views-0.8.1 lib/rails_sql_views/connection_adapters/abstract_adapter.rb
molo-0.7.6 vendor/rails_sql_views/lib/rails_sql_views/connection_adapters/abstract_adapter.rb
molo-0.7.5 vendor/rails_sql_views/lib/rails_sql_views/connection_adapters/abstract_adapter.rb
molo-0.7.4 vendor/rails_sql_views/lib/rails_sql_views/connection_adapters/abstract_adapter.rb
molo-0.7.3 vendor/rails_sql_views/lib/rails_sql_views/connection_adapters/abstract_adapter.rb
molo-0.7.2 vendor/rails_sql_views/lib/rails_sql_views/connection_adapters/abstract_adapter.rb
molo-0.7.1 vendor/rails_sql_views/lib/rails_sql_views/connection_adapters/abstract_adapter.rb
molo-0.7.0 vendor/rails_sql_views/lib/rails_sql_views/connection_adapters/abstract_adapter.rb
rails_sql_views-0.8.0 lib/rails_sql_views/connection_adapters/abstract_adapter.rb