Module: Roomer

Extended by:
Utils
Defined in:
lib/roomer.rb,
lib/roomer/rails.rb,
lib/roomer/utils.rb,
lib/roomer/schema.rb,
lib/roomer/version.rb,
lib/roomer/schema_dumper.rb,
lib/roomer/extensions/model.rb,
lib/roomer/extensions/controller.rb,
lib/roomer/helpers/postgres_helper.rb,
lib/roomer/helpers/generator_helper.rb,
lib/roomer/helpers/migration_helper.rb,
lib/generators/roomer/model/model_generator.rb,
lib/generators/roomer/setup/setup_generator.rb,
lib/generators/roomer/install/install_generator.rb,
lib/generators/roomer/migration/migration_generator.rb

Defined Under Namespace

Modules: Extensions, Generators, Helpers, Utils, VERSION Classes: RoomerEngine, Schema, SchemaDumper

Constant Summary collapse

@@url_routing_strategy =
:domain
@@shared_schema_name =
:global
@@tenants_table =
:tenants
@@tenant_url_identifier_column =
:url_identifier
@@tenant_schema_name_column =
:schema_name
@@schema_seperator =
'.'
@@schemas_directory =
File.expand_path(File.join("db", "schemas"))
@@tenanted_schema_filename =
"tenanted_schema.rb"
@@shared_schema_filename =
"shared_schema.rb"
@@use_tenanted_migrations_directory =
false
@@tenanted_migrations_directory =
File.join(migrations_directory, "tenanted")
@@shared_migrations_directory =
File.join(migrations_directory,shared_schema_name.to_s)
@@heroku_safe =
true

Class Method Summary collapse

Methods included from Utils

current_tenant, current_tenant=, ensure_tenant_model_reset, full_shared_schema_migration_path, full_tenants_table_name, migrations_directory, model_directory, reset_current_tenant, tenant_model

Class Method Details

.setup {|_self| ... } ⇒ Object

Default way to setup Roomer. Run rails generate roomer:install to create a fresh initializer with all configuration values.

Examples:

Roomer.setup do |config|
  config.url_routing_strategy = :domain
end

Yields:

  • (_self)

Yield Parameters:

  • _self (Roomer)

    the object that the method was called on



123
124
125
# File 'lib/roomer.rb', line 123

def self.setup
  yield self
end

.tenanted_migrations_directoryString

Fetches the migrations directory for Tenanted migrations. returns the standard rails migration directory “db/migrate” is the use_tenanted_migrations_directory is set to false

Returns:

  • (String)

    String representing the tenanted migrations



110
111
112
113
114
115
# File 'lib/roomer.rb', line 110

def self.tenanted_migrations_directory
  if self.use_tenanted_migrations_directory
    return @@tenanted_migrations_directory
  end
  return migrations_directory
end