class RailsOptimizer::Association

Attributes

args[RW]
klass[RW]
name[RW]
owner[RW]
reflection[RW]

Public Class Methods

new(owner, name, *args) click to toggle source
# File lib/rails_optimizer/association.rb, line 5
def initialize(owner, name, *args)
        @owner = owner
        @name  = name.to_s
        @args  = *args
end

Public Instance Methods

get_target() { || ... } click to toggle source
# File lib/rails_optimizer/association.rb, line 23
def get_target
        return owner.association(name.to_sym).target if owner.association(name.to_sym).loaded?
        yield if block_given?
end
reflection_scope() click to toggle source
# File lib/rails_optimizer/association.rb, line 19
def reflection_scope
        reflection.scope
end