Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rails 5.1 #2

Open
wants to merge 2 commits into
base: rails-5
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,39 @@ def quote(value_, column_=nil)
if ::RGeo::Feature::Geometry.check_type(value_)
"GeomFromWKB(0x#{::RGeo::WKRep::WKBGenerator.new(:hex_format => true, little_endian: true).generate(value_)},#{value_.srid})"
else
super
if column_
ActiveSupport::Deprecation.warn(<<-MSG.squish)
Passing a column to `quote` has been deprecated. It is only used
for type casting, which should be handled elsewhere. See
https://github.com/rails/arel/commit/6160bfbda1d1781c3b08a33ec4955f170e95be11
for more information.
MSG
end

super(value_)
end
end


def type_to_sql(type_, limit_=nil, precision_=nil, scale_=nil, unsigned_=nil)
if (info_ = spatial_column_constructor(type_.to_sym))
type_ = limit_[:type] || type_ if limit_.is_a?(::Hash)
type_ = 'geometry' if type_.to_s == 'spatial'
type_ = type_.to_s.gsub('_', '').upcase
if Gem.loaded_specs['activerecord'].version < Gem::Version.create('5.1.0')
def type_to_sql(type_, limit_=nil, precision_=nil, scale_=nil, unsigned_=nil)
if (info_ = spatial_column_constructor(type_.to_sym))
type_ = limit_[:type] || type_ if limit_.is_a?(::Hash)
type_ = 'geometry' if type_.to_s == 'spatial'
type_ = type_.to_s.gsub('_', '').upcase
end
super(type_, limit_, precision_, scale_, unsigned_)
end
else
# https://github.com/rails/rails/commit/ae39b1a03d0a859be9d5342592c8936f89fcbacf
def type_to_sql(type_, limit_:nil, precision_:nil, scale_:nil, unsigned_:nil, **rest_)
if (info_ = spatial_column_constructor(type_.to_sym))
type_ = limit_[:type] || type_ if limit_.is_a?(::Hash)
type_ = 'geometry' if type_.to_s == 'spatial'
type_ = type_.to_s.gsub('_', '').upcase
end
super(type_, rest_.merge({limit:limit_, precision:precision_, scale:scale_, unsigned:unsigned_}))
end
super(type_, limit_, precision_, scale_, unsigned_)
end


Expand Down