Skip to content

Instantly share code, notes, and snippets.

@kbaum
Last active December 30, 2015 23:39
Show Gist options
  • Save kbaum/7902146 to your computer and use it in GitHub Desktop.
Save kbaum/7902146 to your computer and use it in GitHub Desktop.
Fragment caching optimization
class MyPortfoliosController < ApplicationController
before_filter :authenticate_user!
def show
@portfolio_properties = my_portfolio_filter.filtered_properties
.includes(:city, :submarket, :photos, :videos, :spaces)
.page(page)
.per(10)
.decorate
@portfolio_spaces = my_portfolio_filter.filtered_spaces(@portfolio_properties.collect(&:id))
.includes(:videos, :property => :users)
end
private
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment