# Quickly clear the Rails cache in development

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.

```ruby
# 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
```
