Created
June 1, 2018 07:51
-
-
Save mipearson/4f5feefb87f5f4156743133180ab97a4 to your computer and use it in GitHub Desktop.
Rails development speedups
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 https://github.com/rails/rails/issues/20752 | |
included do | |
if Rails.env.development? | |
prepend_before_action { ActionView::Resolver.caching = true } | |
after_action { ActionView::Resolver.caching = false } | |
end | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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