Skip to content

Instantly share code, notes, and snippets.

@pirelenito
Created September 25, 2011 23:03
Show Gist options
  • Select an option

  • Save pirelenito/1241294 to your computer and use it in GitHub Desktop.

Select an option

Save pirelenito/1241294 to your computer and use it in GitHub Desktop.
Fast mongoid single collection inheritance with Rails 3.1 Asset Pipeline.
# Allows Mongoid's single collection inheritance to work with the Asset pipeline
# without enabling model preloading, which greatly reduces the performance of
# the application in development mode.
# see: http://martinciu.com/2011/06/rails-3-1-and-slow-asset-pipeline.html
# see: http://groups.google.com/group/mongoid/browse_thread/thread/3d37977a321dc56d?pli=1
# see: http://mongoid.org/docs/rails/railties.html
config.to_prepare do
Dir["#{Rails.root}/app/models/*.rb"].each {|file| require file }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment