Class Index [+]

Quicksearch

Sequel::Plugins::LazyAttributes::InstanceMethods

Private Instance Methods

lazy_attribute_lookup(a) click to toggle source

If the model was selected with other model objects, eagerly load the attribute for all of those objects. If not, query the database for the attribute for just the current object. Return the value of the attribute for the current object.

    # File lib/sequel/plugins/lazy_attributes.rb, line 71
71:         def lazy_attribute_lookup(a)
72:           primary_key = model.primary_key
73:           model.select(*(Array(primary_key) + [a])).filter(primary_key=>retrieved_with.map{|o| o.pk}).all if model.identity_map && retrieved_with
74:           values[a] = this.select(a).first[a] unless values.include?(a)
75:           values[a]
76:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.