On Thu, Oct 8, 2015 at 10:39 AM, Jedrin <[email protected]> wrote:

>  I have a helper like this:
>
>   def table_elements(qualifier, count)
>     if qualifier
>       yield
>     else
>       return ("<td></td>" * count).html_safe
>     end
>   end

Try a NullObject.  That is, supposing qualifier is of type Client,
have a class NullClient where remittance_id and availability_date are
nil.  Make your data include NullClients instead of any nils.  If I
remember rightly, a couple years ago Avdi Grimm put out a gem that
does a lot of the boilerplate in applying the Null Object pattern.

-Dave

-- 
Dave Aronson, consulting software developer of Codosaur.us,
PullRequestRoulette.com, Blog.Codosaur.us, and Dare2XL.com.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAHxKQih_z1DP51hMp3xMmaebf%2BQBkS1a05D4Unud9ymtVuUqrA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to