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

Return a `Point` object from the PG Point type #20448

Merged
merged 1 commit into from Jun 7, 2015

Conversation

Projects
None yet
4 participants
@sgrif
Member

sgrif commented Jun 5, 2015

This introduces a deprecation cycle to change the behavior of the
default point type in the PostgreSQL adapter. The old behavior will
continue to be available for the immediate future as :legacy_point.

The current behavior of returning an Array causes several problems,
the most significant of which is that we cannot differentiate between an
array of points, and a point itself in the case of a column with the
point[] type.

The attributes API gives us a reasonable way to have a proper
deprecation cycle for this change, so let's take advantage of it. If we
like this change, we can also add proper support for the other geometric
types (line, lseg, box, path, polygon, and circle), all of which are
just aliases for string today.

Fixes #20441

Return a `Point` object from the PG Point type
This introduces a deprecation cycle to change the behavior of the
default point type in the PostgreSQL adapter. The old behavior will
continue to be available for the immediate future as `:legacy_point`.

The current behavior of returning an `Array` causes several problems,
the most significant of which is that we cannot differentiate between an
array of points, and a point itself in the case of a column with the
`point[]` type.

The attributes API gives us a reasonable way to have a proper
deprecation cycle for this change, so let's take advantage of it. If we
like this change, we can also add proper support for the other geometric
types (line, lseg, box, path, polygon, and circle), all of which are
just aliases for string today.

Fixes #20441
@sgrif

This comment has been minimized.

Show comment
Hide comment
@sgrif
Member

sgrif commented Jun 5, 2015

@rafaelfranca

This comment has been minimized.

Show comment
Hide comment
@rafaelfranca
Member

rafaelfranca commented Jun 6, 2015

:shipit:

sgrif added a commit that referenced this pull request Jun 7, 2015

Merge pull request #20448 from sgrif/sg-postgresql-point-type
Return a `Point` object from the PG Point type

@sgrif sgrif merged commit ee372bd into rails:master Jun 7, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@sgrif sgrif deleted the sgrif:sg-postgresql-point-type branch Jun 7, 2015

@meinac

This comment has been minimized.

Show comment
Hide comment
@meinac

meinac Jun 7, 2015

This method needs indentation.

This method needs indentation.

@meinac

This comment has been minimized.

Show comment
Hide comment
@meinac

meinac Jun 7, 2015

Contributor

Ups, I was looking at the pr and it has been merged before my comment 😄

Contributor

meinac commented Jun 7, 2015

Ups, I was looking at the pr and it has been merged before my comment 😄

def cast(value)
case value
when ::String

This comment has been minimized.

@mroach

mroach Nov 22, 2016

When an empty string is passed-in, this fails with "can't convert nil into Float". This ends-up happening when a user doesn't enter a value on a form for example. Should this method be converting empty string to nil and storing it as such?

@mroach

mroach Nov 22, 2016

When an empty string is passed-in, this fails with "can't convert nil into Float". This ends-up happening when a user doesn't enter a value on a form for example. Should this method be converting empty string to nil and storing it as such?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment