Repository navigation
Mark non Date/Time objects as invalid - #69
Merged
Merged
Conversation
This should Resolve codegram#48. Given a test model: ```ruby class TestModel attr_accessor :foo validates :foo, date: true def initialize(date) @foo = date end end ``` Behaviour before this patch: ```ruby m = TestModel.new('not a date') m.valid? => true ``` Behaviour after this patch: ```ruby m = TestModel.new('not a date') m.valid? => false ``` The only outstanding question is should a string like `2016-01-08` go through `Date.parse` or `to_date` to try and make it valid.
Member
|
Thanks! |
oriolgual
added a commit
that referenced
this pull request
Jan 13, 2016
Mark non Date/Time objects as invalid
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.
@oriolgual @txus
This should Resolve #48.
Given a test model:
Behaviour before this patch:
Behaviour after this patch:
The only outstanding question is should a string like
2016-01-08gothrough
Date.parseorto_dateto try and make it valid.