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
19
# 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, :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

#supports_view_columns_definition?Boolean

Returns:

  • (Boolean)


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

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)


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

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)


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

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