I'm trying to iterate through an array defined in a model, to show all the days from the array, but I get this error.
"undefined local variable or method `day'"
I'm a newbie and I can't figure out how to fix it, so any help would be much appreciated.
schedule.rb
class Schedule < ApplicationRecord
def self.days
['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday']
end
end
_form.html.erb
<% Schedule.days.each |day| %>
<h2><%= day.titleize %>: <%= Date.today.send(day) %></h2>
<% end %>