Module: Roomer

Defined in:
lib/roomer.rb,
lib/roomer/tools.rb,
lib/roomer/rails.rb,
lib/roomer/version.rb,
lib/generators/setup/setup_generator.rb,
lib/generators/install/install_generator.rb

Defined Under Namespace

Modules: Generators, VERSION Classes: Engine, Tools

Constant Summary

@@url_routing_strategy =
:domain
@@shared_schema_name =
:global
@@tenants_table =
:tenant
@@tenant_url_identifier_column =
:url_identifier
@@tenant_schema_name_column =
:schema_name
@@schema_seperator =
'.'
@@shared_migrations_directory =
File.join(migrations_directory,shared_schema_name.to_s)
@@tenanted_migrations_directory =
File.join(migrations_directory,tenants_table.to_s)

Class Method Summary (collapse)

Class Method Details

+ (String) full_shared_shema_migration_path

Constructs the full path to the shared schema directory Example: /Users/Greg/Projects/roomer/db/migrate/global

Returns:

  • (String)

    full path to the shared schema directory



74
75
76
# File 'lib/roomer.rb', line 74

def self.full_shared_shema_migration_path
  "#{Rails.root}/#{shared_migrations_directory}"
end

+ (String) full_tenants_table_name

Consutructs the full name for the tenants table with schema Example: ‘global.tenant’

Returns:

  • (String)

    full name of the tenant table



67
68
69
# File 'lib/roomer.rb', line 67

def self.full_tenants_table_name
  "#{shared_schema_name}#{schema_seperator}#{tenants_table}"
end

+ (String) migrations_directory

Rails DB Migrations Directory

Returns:

  • (String)

    full path to the migrations directory



52
53
54
# File 'lib/roomer.rb', line 52

def self.migrations_directory
  File.join("db","migrate")
end

+ (Object) setup {|_self| ... }

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



86
87
88
# File 'lib/roomer.rb', line 86

def self.setup
  yield self
end