Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Rails development speedups
# include this mixin (or put the code directly) into your application_controller.rb
module Shared
module DevelopmentViewResolveCaching
extend ActiveSupport::Concern
# Speeds up development view rendering by about ~300ms as we don't need
# to call the slow view resolver more than once per partial.
# From
included do
if Rails.env.development?
prepend_before_action { ActionView::Resolver.caching = true }
after_action { ActionView::Resolver.caching = false }
# Put this in config/initializers, customise to your own needs
# Unregistering these unused handlers speeds up view template resolution.
ActionView::Template.unregister_template_handler(:raw, :ruby, :coffee)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment