Created
March 22, 2017 17:13
-
-
Save jarod022/0e94fc83eb9077649fb34a168d76b6ec to your computer and use it in GitHub Desktop.
Rails: how to save up database queries using cache
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
class ApplicationController < ActionController::Base | |
before_action :fetch_settings | |
helper_method :settings | |
private | |
def fetch_settings | |
@__settings = SettingsCacher.new.fetch | |
end | |
protected | |
def settings | |
@__settings | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment