module StaleOptions::Backend
Protected Instance Methods
if_stale?(record, options = {}) { |record| ... }
click to toggle source
Usage:
class ItemsController < ApplicationController include StaleOptions::Backend def index if_stale?(Item.all) do |items| render json: items end end end
# File lib/backend/backend.rb, line 17 def if_stale?(record, options = {}) if stale?(StaleOptions.create(record, options)) block_given? ? yield(record) : true end end
unless_stale?(record, options = {}) { |record| ... }
click to toggle source
# File lib/backend/backend.rb, line 23 def unless_stale?(record, options = {}) unless stale?(StaleOptions.create(record, options)) block_given? ? yield(record) : true end end