6015f1c7d2c5057f668f4951f3303b28

Here' is the truth table:

hide_user_bar is undefined.... render the partial
hide_user_bar is false.... render the partial
hide_user_bar is true.... DON'T render the partial.

Is there any way to do it without typing hide_user_bar twice? Ideally with one operator/function? I could just write a defined_and_true? function but i was hoping there was already such an operator.

<%= render :partial => 'users/user_bar' unless defined? hide_user_bar and hide_user_bar %>

Refactorings

No refactoring yet !

Your refactoring





Format Copy from initial code

or Cancel