Skip to content

Instantly share code, notes, and snippets.

@wangjohn
Last active December 15, 2015 16:38
Show Gist options
  • Save wangjohn/5290145 to your computer and use it in GitHub Desktop.
Save wangjohn/5290145 to your computer and use it in GitHub Desktop.
Progress on Application Specific Rails Configuration

Tests Which Are Failing: test/generators/plugin_new_generator_test.rb (unable to open database file) - These tests fail because of the bundle install which takes the railties gem from master.

test/application/assets_test.rb - For some reason, the assets are really broken. - Seems like we're unable to open the database file, and this is causes the tests to fail.

Database File: /home/john/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb

Current Fix:

  • Set Rails::Application.config to a cached configuration. Then Rails.config is just the configuration found in Rails.application.config.
  • Configurations are Rails::Application class specific. If you subclass it, the application can have a new config, but it will default to the config in Rails.application.config.

What I know: Looking very carefully at the asset classes and at Sprockets-Rails, I've found that there are certain after_initialize hooks that get called to load in all the necessary sprockets and assets. These things are created in sprockets-rails/lib/railties.rb and from there they hijack the assets in the main rails application.

Something that is happening is that in the /config/production.rb file, the cache_classes should be set to true and the config should change based on the AppTemplate::Application.configure do command. However, for some reason this isn't happening in my new app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment