I have a hash containing key value pairs, and I'm trying to use a ternary if but it doesn't seem to work.
<%= @positions.key? 'dashboard' %> # => true
<%= @positions.key? 'dashboard' ? 'true text' : 'no text' %> # => false
Am I not using the correct code? If this doesn't work is there a way to check if a hash key exists using a ternary if condition?
Add parenthesis around parameter:
<%= @positions.key?('dashboard') ? 'true text' : 'no text' %>