<% if dashboard_pane_counter.remainder(3) == 0 %>
do something
<% end>
If dasboard_pane_counter wasn't defined, how can I get this to evaluate to false rather than throw an exception?
Answer
<% if defined?(:dashboard_pane_counter) && dashboard_pane_counter.remainder(3) == 0 %>
# do_something here, this assumes that dashboard_pane_counter is defined, but not nil
<% end %>
No comments:
Post a Comment