Sha256: 54b4fe11189a50549067c2091bf16007b93f1bbea206352ae4f4e50b0cef84a5
Contents?: true
Size: 1.69 KB
Versions: 4
Compression:
Stored size: 1.69 KB
Contents
require 'rails' module Apartment class Railtie < Rails::Railtie # # Set up our default config options # Do this before the app initializers run so we don't override custom settings # config.before_initialize do Apartment.configure do |config| config.excluded_models = [] config.use_postgres_schemas = true config.database_names = [] config.seed_after_create = false config.prepend_environment = true end end # Hook into ActionDispatch::Reloader to ensure Apartment is properly initialized # Note that this doens't entirely work as expected in Development, because this is called before classes are reloaded # See the above middleware/console declarations below to help with this. Hope to fix that soon. # config.to_prepare do Apartment::Database.init end # # Ensure rake tasks are loaded # rake_tasks do load 'tasks/apartment.rake' end # # The following initializers are a workaround to the fact that I can't properly hook into the rails reloader # Note this is technically valid for any environment where cache_classes is false, for us, it's just development # if Rails.env.development? # Apartment::Reloader is middleware to initialize things properly on each request to dev initializer 'apartment.init' do |app| app.config.middleware.use "Apartment::Reloader" end # Overrides reload! to also call Apartment::Database.init as well so that the reloaded classes have the proper table_names console do require 'apartment/console' end end end end
Version data entries
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
dr-apartment-0.14.1 | lib/apartment/railtie.rb |
apartment-0.14.2 | lib/apartment/railtie.rb |
apartment-0.14.1 | lib/apartment/railtie.rb |
apartment-0.14.0 | lib/apartment/railtie.rb |