sinatra / sinatra-recipes

Community contributed recipes and techniques
http://recipes.sinatrarb.com/
462 stars 141 forks source link

fix to_json twice #72

Closed ghost closed 10 years ago

ghost commented 11 years ago

A found document has been converted to JSON twice.

ashleygwilliams commented 11 years ago

i see the redundancy... but why remove it from the helper and not all the calls to document_by_id?

ghost commented 11 years ago

because i think it makes the intention of JSON converting clear. is it better to include to_json than to remove it with respect to duplication?

kgrz commented 11 years ago

Agree. The one in the partial needs to go. Or, the helper name should be changed to suggest that it returns a JSON string and the other calls outside the helper can be removed then.

ashleygwilliams commented 11 years ago

agree with both points. i sorta think renaming the helper and keeping the to_json there makes the most sense.

ghost commented 10 years ago

Yep. I just get rid off .to_json. It works pretty well. May I close this issue?