Skip to content

Instantly share code, notes, and snippets.

@obie
Created October 5, 2020 05:15
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save obie/9ba2e226c33c9d783970c1a2d212c87f to your computer and use it in GitHub Desktop.
Save obie/9ba2e226c33c9d783970c1a2d212c87f to your computer and use it in GitHub Desktop.
Workaround solution for having to restart Rails server to pickup changes to ViewComponent templates (Rails 6.1)
class ApplicationController < ActionController::Base
after_action :clear_view_component_cache, if: -> { Rails.env.development? }
def clear_view_component_cache
ViewComponent::CompileCache.cache = Set.new
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment