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



18
19
20
21
22
23
24
# File 'lib/rails_sql_views/connection_adapters/abstract_adapter.rb', line 18

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_drop_table_cascade?Boolean

Subclasses should override and return false if they don’t support CASCADE

Returns:

  • (Boolean)


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

def supports_drop_table_cascade?
  return true
end

#supports_view_columns_definition?Boolean

Returns:

  • (Boolean)


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

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)


36
37
38
# File 'lib/rails_sql_views/connection_adapters/abstract_adapter.rb', line 36

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)


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

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