Closed mrcasals closed 8 years ago
@mrcasals Thanks so much for the addition!! It's all merged and I'll cut a release for you now so you can update the gem in your project.
ā¤ļø š š š š
@mrcasals 0.7.1 is now release with your change :smile:
Yay, thanks for the fast reply and for your work on rectify! Works awesomely! š
I'm using
rectify
at https://github.com/codegram/decidim/pull/147 and I'm having problems trying to render the results of a query object in a view using both these methods:I'm getting this error:
My first try was calling the
query
method on the query object in the view:This didn't raise any error, but didn't render anything actually so it's not useful. Also, explicitly calling this method from the view feels weird.
Checking the Rails source code, Rails tries to check if the collection passed to the
render
method responds toto_ary
. If it does not, it uses an empty array as the collection and thus it does not render anything (which is weird, actually):https://github.com/rails/rails/blob/28a6571bae1d6bc1c774e8e501720374061a31f1/actionview/lib/action_view/renderer/partial_renderer.rb#L406
So my take is defining the
to_ary
method in the Query class as an alias fromto_a
. Both the unit tests and the tests I took on my app are green with this change.