I am converting a Rails app to Roda. Here's a section of a partial.
# _banner.erb
<% if banner.present? %>
...
<% end %>
This returns the error: NoMethodError: undefined method 'present?' for []:Array
.
How can I get Roda to support something simple like checking if a variable is present?
All present?
does is negate blank?
which in turns looks like this. You could add this to your helper/service classes depending on your setup.
def present?
!blank?
end
def blank?
respond_to?(:empty?) ? !!empty? : !self
end