Module: RailsSqlViews::ConnectionAdapters::AbstractAdapter

Defined in:
lib/rails_sql_views/connection_adapters/abstract_adapter.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
# File 'lib/rails_sql_views/connection_adapters/abstract_adapter.rb', line 4

def self.included(base)
  base.alias_method_chain :disable_referential_integrity, :views_excluded
end

Instance Method Details

#disable_referential_integrity_with_views_excluded(&block) ⇒ Object



13
14
15
16
17
18
# File 'lib/rails_sql_views/connection_adapters/abstract_adapter.rb', line 13

def disable_referential_integrity_with_views_excluded(&block)
  self.class.send(:alias_method, :tables, :base_tables)
  disable_referential_integrity_without_views_excluded(&block)
ensure
  self.class.send(:alias_method, :tables, :tables_with_views_included)
end

#supports_view_columns_definition?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/rails_sql_views/connection_adapters/abstract_adapter.rb', line 20

def supports_view_columns_definition?
  true
end

#supports_views?Boolean

Subclasses should override and return true if they support views.

Returns:

  • (Boolean)


9
10
11
# File 'lib/rails_sql_views/connection_adapters/abstract_adapter.rb', line 9

def supports_views?
  return false
end

#view_select_statement(view, name = nil) ⇒ Object

Get the select statement for the specified view

Raises:

  • (NotImplementedError)


30
31
32
# File 'lib/rails_sql_views/connection_adapters/abstract_adapter.rb', line 30

def view_select_statement(view, name=nil)
  raise NotImplementedError, "view_select_statement is an abstract method"
end

#views(name = nil) ⇒ Object

Get a list of all views for the current database

Raises:

  • (NotImplementedError)


25
26
27
# File 'lib/rails_sql_views/connection_adapters/abstract_adapter.rb', line 25

def views(name = nil)
  raise NotImplementedError, "views is an abstract method"
end