Top Level Namespace
Defined Under Namespace
Modules: ActiveRecord, Apartment
Instance Method Summary collapse
-
#config ⇒ Object
Apartment Configuration.
-
#reload!(print = true) ⇒ Object
reloads the environment.
Instance Method Details
#config ⇒ Object
Apartment Configuration
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/generators/apartment/install/templates/apartment.rb', line 3 Apartment.configure do |config| # these models will not be multi-tenanted, # but remain in the global (public) namespace config.excluded_models = %w{ ActiveRecord::SessionStore::Session } # use postgres schemas? config.use_postgres_schemas = true # configure persistent schemas (E.g. hstore ) # config.persistent_schemas = %w{ hstore } # add the Rails environment to database names? # config.prepend_environment = true # config.append_environment = true # supply list of database names config.database_names = lambda{ ToDo_Tenant_Or_User_Model.scoped.collect(&:database) } end |
#reload!(print = true) ⇒ Object
reloads the environment
5 6 7 8 9 10 11 12 |
# File 'lib/apartment/console.rb', line 5 def reload!(print=true) puts "Reloading..." if print # This triggers the to_prepare callbacks ActionDispatch::Callbacks.new(Proc.new {}).call({}) # Manually init Apartment again once classes are reloaded Apartment::Database.init true end |