module RespondToFaster

Constants

VERSION

Public Instance Methods

find_by_sql(sql, binds = [], preparable: nil, &block) click to toggle source
Calls superclass method
# File lib/respond_to_faster.rb, line 5
def find_by_sql(sql, binds = [], preparable: nil, &block)
  super.tap do |records|
    record = records.first
    unless record.nil? || (uncached_attrs = record.attribute_names - attribute_names).empty?
      uncached_attrs.each &record.singleton_class.method(:define_method_attribute)
      mod = record.singleton_class.send(:generated_attribute_methods)
      records[1..-1].each { |record| record.singleton_class.include mod }
    end
  end
end