module ActiveRecord::PLSQL::Pipelined

Attributes

found_by_arguments[RW]

Public Instance Methods

reload(options = nil) click to toggle source
Calls superclass method
# File lib/active_record/plsql/pipelined.rb, line 111
def reload(options = nil)
  return super unless pipelined? && (found_by_arguments.present? || options)

  clear_aggregation_cache
  clear_association_cache

  ActiveRecord::IdentityMap.without do
    fresh_object = self.class.unscoped do
      relation = self.class.where(self.class.primary_key => id)

      if found_by_arguments
        relation.bind_values += found_by_arguments
        relation.to_a.first
      else
        relation.where(options).to_a.first
      end
    end

    @attributes.update(fresh_object.instance_variable_get('@attributes'))
  end

  @attributes_cache = {}
  self
end