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

Fix allow_blank supporting DateTime/Date #916

Merged
merged 1 commit into from
Feb 8, 2015
Merged

Fix allow_blank supporting DateTime/Date #916

merged 1 commit into from
Feb 8, 2015

Conversation

u2
Copy link
Contributor

@u2 u2 commented Feb 6, 2015

@@ -7,4 +7,5 @@ group :development, :test do
gem 'guard'
gem 'guard-rspec'
gem 'guard-rubocop'
gem 'byebug'
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove it, please.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you.I forgot it.

@dblock
Copy link
Member

dblock commented Feb 6, 2015

Needs CHANGELOG, too, please.

@kuraga
Copy link
Contributor

kuraga commented Feb 7, 2015

Hm... Is val == "" dangerous, isn't?

Can val be a non-String here?
If can then "" == val maybe?
Or val.empty? with some additional conditions?

Which values of val are possible?

@u2
Copy link
Contributor Author

u2 commented Feb 7, 2015

Before I wrote val.is_a?(String) && val.empty?,but I thought it's the same meaning of val == "".
Yes, you are right.This val can be a non-String.I will change it asap.Thanks.
@kuraga Updated!

@@ -29,9 +29,12 @@ def _valid_single_type?(klass, val)
# allow nil, to ignore when a parameter is absent
return true if val.nil?
if klass == Virtus::Attribute::Boolean
val.is_a?(TrueClass) || val.is_a?(FalseClass)
val.is_a?(TrueClass) || val.is_a?(FalseClass) || val == ''
Copy link
Contributor

Choose a reason for hiding this comment

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

@u2 And here, too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry.Updated again.

@dblock
Copy link
Member

dblock commented Feb 8, 2015

Merging, thanks.

dblock added a commit that referenced this pull request Feb 8, 2015
Fix allow_blank supporting DateTime/Date
@dblock dblock merged commit 5e48701 into ruby-grape:master Feb 8, 2015
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.

3 participants