Sha256: fc8786fdaa9a41217de435fbb3bc280e39b727820763beab9592e192e74c4023

Contents?: true

Size: 449 Bytes

Versions: 5

Compression:

Stored size: 449 Bytes

Contents

module EdgeRider
  module PreloadAssociations

    def preload_associations(*args)
      ActiveRecord::Associations::Preloader.new(*args).run
    end

    if ActiveRecord::Base.respond_to?(:preload_associations, true) # Rails 2.3, Rails 3.0
      ActiveRecord::Base.class_eval do
        class << self
          public :preload_associations
        end
      end
    else # Rails 3.2+
      ActiveRecord::Base.send(:extend, self)
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
edge_rider-0.2.5 lib/edge_rider/preload_associations.rb
edge_rider-0.2.4 lib/edge_rider/preload_associations.rb
edge_rider-0.2.3 lib/edge_rider/preload_associations.rb
edge_rider-0.2.2 lib/edge_rider/preload_associations.rb
edge_rider-0.2.1 lib/edge_rider/preload_associations.rb