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

Replace nil values with empty strings #411

Merged
merged 2 commits into from Apr 23, 2013
Merged

Replace nil values with empty strings #411

merged 2 commits into from Apr 23, 2013

Conversation

manuelmeurer
Copy link
Contributor

As discussed in #402

@databyte
Copy link
Collaborator

Overall it looks good but it has to support 1.8.7.

Specifically each_with_object doesn't exist in 1.8.7 so you have to rewrite that bit. Sucks, yeah.

ERROR
  Rabl::Builder #to_hash when nil values are replaced with empty strings asserts that an empty string is returned as the value => undefined method `each_with_object' for {:name=>nil}:Hash occured
    at /home/travis/build/nesquena/rabl/test/builder_test.rb:52
    at /home/travis/build/nesquena/rabl/lib/rabl/builder.rb:20:in `build'
    at /home/travis/build/nesquena/rabl/lib/rabl/builder.rb:163:in `cache_results'
    at /home/travis/build/nesquena/rabl/lib/rabl/builder.rb:21:in `build'
    at /home/travis/build/nesquena/rabl/lib/rabl/builder.rb:62:in `compile_hash'

@nesquena
Copy link
Owner

Yeah we can probably just replace each_with_object for inject right and then return the hash on the last line for 1.8.7 support.

@manuelmeurer
Copy link
Contributor Author

Any plans to merge this in?

nesquena added a commit that referenced this pull request Apr 23, 2013
…trings

Replace nil values with empty strings
@nesquena nesquena merged commit 1a9c5ce into nesquena:master Apr 23, 2013
@nesquena
Copy link
Owner

Thanks!

@manuelmeurer
Copy link
Contributor Author

Great! Could you release v0.8.4?

@nesquena
Copy link
Owner

Yep released!

@manuelmeurer
Copy link
Contributor Author

Cheers!

@manuelmeurer manuelmeurer deleted the replace_nils_with_empty_strings branch April 23, 2013 06:45
DouweM added a commit to DouweM/rabl that referenced this pull request Oct 8, 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.

3 participants