Skip to content

Instantly share code, notes, and snippets.

@DanielWright
Created July 25, 2013 17:54
Show Gist options
  • Save DanielWright/6082147 to your computer and use it in GitHub Desktop.
Save DanielWright/6082147 to your computer and use it in GitHub Desktop.
Rails4/ActiveAdmin/Heroku precompilation workaround
# config/application.rb
# ...
module MyApp
class Application < Rails::Application
# ...
config.before_initialize do
Dir.glob(Rails.root.join('lib/**/*.rb')) do |c|
Rails.configuration.cache_classes ? require(c) : load(c)
end
end
# ...
end
end
# lib/extensions/active_admin/resource.rb
module Extensions
module ActiveAdmin
module Resource
extend ActiveSupport::Concern
included do
def default_options
{ sort_order: 'id_desc' }
end
end
end
end
end
::ActiveAdmin::Resource.send(:include, Extensions::ActiveAdmin::Resource)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment