Return a Point object from the PG Point type#20448
Merged
Merged
Conversation
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 rails#20441
Contributor
Author
Member
|
|
sgrif
added a commit
that referenced
this pull request
Jun 7, 2015
Return a `Point` object from the PG Point type
Contributor
|
Ups, I was looking at the pr and it has been merged before my comment 😄 |
mroach
reviewed
Nov 22, 2016
|
|
||
| def cast(value) | ||
| case value | ||
| when ::String |
There was a problem hiding this comment.
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?
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Arraycauses 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