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

Don't type cast the default on the column #15782

Merged
merged 1 commit into from
Jun 18, 2014

Conversation

sgrif
Copy link
Contributor

@sgrif sgrif commented Jun 17, 2014

If we want to have type decorators mess with the attribute, but not the
column, we need to stop type casting on the column. Where possible, we
changed the tests to test the value of column_defaults, which is
public API. Column#default is not.

If we want to have type decorators mess with the attribute, but not the
column, we need to stop type casting on the column. Where possible, we
changed the tests to test the value of `column_defaults`, which is
public API. `Column#default` is not.
@@ -23,7 +23,8 @@ def prepare_column_options(column, types)
spec[:precision] = column.precision.inspect if column.precision
spec[:scale] = column.scale.inspect if column.scale
spec[:null] = 'false' unless column.null
spec[:default] = column.type_cast_for_schema(column.default) if column.has_default?
spec[:default] = schema_default(column) if column.has_default?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Less operations to do:

default = schema_default(column) if column.has_default?
spec[:default] = default unless default.nil?

matthewd added a commit that referenced this pull request Jun 18, 2014
Don't type cast the default on the column
@matthewd matthewd merged commit 51b6670 into rails:master Jun 18, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants