I am writing a helper method for my rails views. After evaluating each value in an array I want to output a button to the html. However, 'puts' is not working and 'return' will work only for one value and end the operator there only.
def show_power_buttons
levels = [1, 2, 3, 4, 5]
levels.each do |level|
count = @player.powers.where(level: level).count
if count > 0
puts (link_to level, '#', :class => 'btn btn-primary')
end
end
end
I know I am missing something very obvious but unable to figure it out.