Created
July 19, 2011 20:37
-
-
Save tetsutan/1093641 to your computer and use it in GitHub Desktop.
activerecord-mysql2spatialのfixtureを読んでテストするためのパッチ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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