Skip to content

Instantly share code, notes, and snippets.

@jarod022
Created March 22, 2017 17:12
Show Gist options
  • Save jarod022/d359f65ecefedff011cc8e0d13d1404f to your computer and use it in GitHub Desktop.
Save jarod022/d359f65ecefedff011cc8e0d13d1404f to your computer and use it in GitHub Desktop.
Rails: how to save up database queries using cache
class Setting < ActiveRecord::Base
after_save :update_cached_settings
private
def update_cached_settings
SettingsCacher.new.write
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment