I have the following:
:caption => thread.thread_widgets.first.widgetable.title
That works fine if the thread has a thread_widget, which is optional. Given it’s optional, if the thread has no thread_widgets, then this errors with
undefined method `widgetable' for nil:NilClass
Is there a way I can use try() so that the error doesn’t kill the page?
Thanks
But you asked for
Object#try,so: