Sha256: 35beeb90814a08fa83b064ec1e6bd639e4a7ebbb986781616653c7c53db1deb2

Contents?: true

Size: 296 Bytes

Versions: 4

Compression:

Stored size: 296 Bytes

Contents

class ApplicationController < ActionController::Base
  def index
    @tweets = Tweet.all
    if eager_load?
      @tweets = @tweets.precount(:replies).preload(in_reply_to: :favorites_count)
    end
  end

  def eager_load?
    params[:eager_load] == 'true'
  end
  helper_method :eager_load?
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
activerecord-precount-0.4.3 sample/app/controllers/application_controller.rb
activerecord-precount-0.4.2 sample/app/controllers/application_controller.rb
activerecord-precount-0.4.1 sample/app/controllers/application_controller.rb
activerecord-precount-0.4.0 sample/app/controllers/application_controller.rb