Module: Scenic

Defined in:
lib/scenic.rb,
lib/scenic/view.rb,
lib/scenic/index.rb,
lib/scenic/railtie.rb,
lib/scenic/version.rb,
lib/scenic/definition.rb,
lib/scenic/statements.rb,
lib/scenic/configuration.rb,
lib/scenic/schema_dumper.rb,
lib/scenic/command_recorder.rb,
lib/scenic/adapters/postgres.rb,
lib/generators/scenic/generators.rb,
lib/scenic/adapters/postgres/views.rb,
lib/scenic/adapters/postgres/errors.rb,
lib/generators/scenic/materializable.rb,
lib/scenic/adapters/postgres/indexes.rb,
lib/scenic/adapters/postgres/connection.rb,
lib/generators/scenic/view/view_generator.rb,
lib/generators/scenic/model/model_generator.rb,
lib/scenic/command_recorder/statement_arguments.rb,
lib/scenic/adapters/postgres/index_reapplication.rb,
lib/scenic/adapters/postgres/refresh_dependencies.rb

Overview

Scenic adds methods ActiveRecord::Migration to create and manage database views in Rails applications.

Defined Under Namespace

Modules: Adapters, Generators, Statements Classes: Configuration, Index, Railtie, View

Constant Summary

VERSION =
"1.3.0".freeze

Class Method Summary collapse

Class Method Details

.configurationScenic::Configuration

Returns Scenic's current configuration

Returns:



15
16
17
# File 'lib/scenic/configuration.rb', line 15

def self.configuration
  @configuration ||= Configuration.new
end

.configuration=(config) ⇒ Object

Set Scenic's configuration

Parameters:



22
23
24
# File 'lib/scenic/configuration.rb', line 22

def self.configuration=(config)
  @configuration = config
end

.configure {|config| ... } ⇒ Object

Modify Scenic's current configuration

Scenic.configure do |config|
  config.database = Scenic::Adapters::Postgres.new
end

Yield Parameters:



34
35
36
# File 'lib/scenic/configuration.rb', line 34

def self.configure
  yield configuration
end

.databaseObject

The current database adapter used by Scenic.

This defaults to Scenic::Adapters::Postgres but can be overridden via Configuration.



29
30
31
# File 'lib/scenic.rb', line 29

def self.database
  configuration.database
end

.loadObject

Hooks Scenic into Rails.

Enables scenic migration methods, migration reversability, and schema.rb dumping.



19
20
21
22
23
# File 'lib/scenic.rb', line 19

def self.load
  ActiveRecord::ConnectionAdapters::AbstractAdapter.include Scenic::Statements
  ActiveRecord::Migration::CommandRecorder.include Scenic::CommandRecorder
  ActiveRecord::SchemaDumper.prepend Scenic::SchemaDumper
end