Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tetsutan/1093641 to your computer and use it in GitHub Desktop.
Save tetsutan/1093641 to your computer and use it in GitHub Desktop.
activerecord-mysql2spatialのfixtureを読んでテストするためのパッチ
# tyano added
module ActiveRecord
module ConnectionAdapters
module Quoting
def quote_with_spatial(value, column = nil)
if(column && column.type == :spatial)
case value
when String
"GeomFromText('#{quote_string(value)}')"
# TODO
# 今はWKTのみ
# WKBにも対応したい.
# activerecord-mysql2spatial-adapterのどこかにソースあるので
# 本来callするだけでいいはず
#when Geo # FIXME
end
else
quote_without_spatial(value,column)
end
end
alias_method_chain :quote, :spatial
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment