-
Notifications
You must be signed in to change notification settings - Fork 26
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
Transforms dates by default #2
Comments
And, if you define a transformer for dates everything breaks when reading a date string over HTTP with:
This when defining the class with a date property like:
This works as expected, it parses the date to a Date object:
You can work around this if you define your transformer as:
|
I experienced something related to this issue. We implemented our date transformers with the assumption that strings will be automatically transformed into date objects first. But then after an update of the httparty gem version to 0.8.0, the date strings we're not being transformed automatically anymore. So if you want the strings to not be transformed automatically, maybe try locking your httparty version to 0.8.0, if not, then use 0.7.8. Hope this may be helpful to someone. |
Thanks fcbajao, i actually implemented the API-consumer in an async fashion with EventMachine's HttpRequest gem instead. But thanks for the info, it will be useful in the future! |
hey guys i am having the same problem and i'm stuck, can't figure it out. can you please help me. is there a way to format the date so that it gets parsed the right way? here is the error i'm getting undefined method `gsub!' for Thu, 05 Jan 2012:Date |
Hi,
When I have response containing a date on the form yyyy-mm-dd this is automatically transformed to a date, even without a proper Date.parse transformer.
I believe that it should be up to the developer to decide if the dates should be transformed or not, do you guys agree with me? And I also believe that this issue is created buy the Crack JSON parser, perhaps you can use another one if you? WebMock recently had the same problem, and they switched to their own version of Crack. See bblimke/webmock@772585e
This is an example of this behavior:
Thanks for a great gem, looking forward to use this in my project!
The text was updated successfully, but these errors were encountered: