Skip to content

Instantly share code, notes, and snippets.

@natikgadzhi
Created February 15, 2010 15:12
Show Gist options
  • Save natikgadzhi/304712 to your computer and use it in GitHub Desktop.
Save natikgadzhi/304712 to your computer and use it in GitHub Desktop.
module ActiveRecord
module ConnectionAdapters
class MysqlAdapter
def select(sql, name = nil)
@connection.query_with_result = true
result = execute(sql, name)
rows = result.all_hashes
result.free
#fix begin
if @config[:encoding] && @config[:encoding]=="utf8"
rows.each do |row|
row.each do |key, value|
if (value.class == String)
value.force_encoding("UTF-8")
end
end
end
end
#fix end
rows
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment