plataformatec/show_for — pull request #51 by denispeplin (2012-09-26 08:59:18+00:00)
Title: Fix belongs_to associations with block

There is attempt to fix issue #50.

The only difference between `has_many` and `belongs_to` for show_for is that `has_many` returns array, and `belongs_to` returns single object, that is not wrapped inside array. So simple `Array.wrap` fixes the issue. Only one line of code. But wrapping `belongs_to` 'collection' inside `collection_tag` is not needed, it is better to display it inline with its label, so some additional code is needed.

It maybe looks like a hack, because `options[:collection_tag]` is set to empty string, and `wrap_with` was modified to handle empty tags correctly. I'm not sure is it better to use some instance variable instead.