diff --git a/lib/github/sql.rb b/lib/github/sql.rb index a004b74..ca94ed4 100644 --- a/lib/github/sql.rb +++ b/lib/github/sql.rb @@ -210,10 +210,7 @@ def models(klass) return @models if defined? @models return [] if frozen? - # Use select_all to retrieve hashes for each row instead of arrays of values. - @models = connection. - select_all(query, "#{klass.name} Load via #{self.class.name}"). - map { |record| klass.send :instantiate, record } + @models = klass.find_by_sql(query) retrieve_found_row_count freeze