Skip to content

Commit

Permalink
Make #create_column_definition a private method
Browse files Browse the repository at this point in the history
* Fix method signature
  • Loading branch information
teeparham committed Nov 4, 2014
1 parent a0badaf commit 0b1a656
Showing 1 changed file with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def initialize(types, name, temporary, options, as, adapter)
super(types, name, temporary, options, as)
end

def column(name, type = nil, options = {})
def column(name, type, options = {})
if (info = @adapter.spatial_column_constructor(type.to_sym))
type = options[:type] || info[:type] || type
if type.to_s == 'geometry' && (options[:no_constraints] || options[:limit].is_a?(::Hash) && options[:limit][:no_constraints])
Expand Down Expand Up @@ -47,14 +47,6 @@ def column(name, type = nil, options = {})
self
end

def create_column_definition(name, type)
if type == :spatial || type == :geography
PostGISAdapter::ColumnDefinition.new(name, type)
else
super
end
end

def non_geographic_spatial_columns
@spatial_columns_hash.values
end
Expand All @@ -67,6 +59,15 @@ def geography(name, options = {})
column(name, :geography, options)
end

private

def create_column_definition(name, type)
if %i[spatial geography].include?(type)
PostGISAdapter::ColumnDefinition.new(name, type)
else
super
end
end
end

class ColumnDefinition < PostgreSQL::ColumnDefinition # :nodoc:
Expand Down

0 comments on commit 0b1a656

Please sign in to comment.