-
-
Notifications
You must be signed in to change notification settings - Fork 195
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
DateTime fields need to be passed as strings or else we get an error #448
Comments
Could you please provide a code snippet to reproduce the issue? The issue is DynamoDB doesn't support Date/Time/DateTime type internally so such columns are stored either as number of seconds or as a string. Looks like an attribute value somehow isn't type casted by Dynamoid. |
Something like this:
When getting a record from DynamoDB there are no issues casting a DynamoDB string to ruby datetime, however when attempting to save a datetime object, it isn't casted to string to persist on DynamoDB. But shouldn't datetime values be auto-casted if the declared field attribute is string? |
I see. Yes, it's definitely a bug in the |
thank you @jmonsanto for providing the example, I dropped the ball on that when I saw the notification and then completely forgot about it, sorry! |
howdy!
First of all I'd like to thank everyone for their effort on this gem, I truly appreciate all of you work.
I'm new to the gem and DynamoDB overall, so excuse my noob question.
According to the README (and rspec files), I was under the impression that we could pass a
DateTime
object to a field that is configured to be of type:datetime
, however when trying to set a field to a value like this:I get an error saying
unsupported type, expected Hash, Array, Set, String, Numeric, IO, true, false, or nil, got DateTime
you can see the stack trace here:
However, if I change the value to be:
while keeping the type as
:datetime
everything works. I feel it's odd that I'd have to pass aString
, which if I'm not mistaken, then gets converted to aDateTime
by the type caster, and then to a number.Am I doing something wrong?
The text was updated successfully, but these errors were encountered: