Skip to content

Instantly share code, notes, and snippets.

@tpope
Created April 19, 2017 19:36
Show Gist options
  • Save tpope/1610e14266ca9eaaddaefe9adf665f12 to your computer and use it in GitHub Desktop.
Save tpope/1610e14266ca9eaaddaefe9adf665f12 to your computer and use it in GitHub Desktop.
ActiveRecord::Base.connection.select_all(scope.arel).tap do |result|
result.map do |attrs|
attrs.each do |k, v|
attrs[k] = result.column_types[k].type_cast(v)
end
end
end 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment