Quickly clear the Rails cache in development

By Adrian Marin

- October 22, 2025

Use this quick helping before_action to quickly bust the cache in development.

You need to add this snippet in your application_controller.rb and then append the clear_cache=1 param to any URL you visit.

# app/controllers/application_controller.rb

# Append this param to bust the cache in development 🙌
# https://localhost:3000?clear_cache=true
before_action :clear_cache_if_requested if Rails.env.development?

def clear_cache_if_requested
  Rails.cache.clear if params[:clear_cache].present?
end

Build your next rails app 10x faster with Avo

Avo dashboard showcasing data visualizations through area charts, scatterplot, bar chart, pie charts, custom cards, and others.

Find out how Avo can help you build admin experiences with Rails faster, easier and better.