I've read this thread: Rails optional argument and tried to implement it in a Rails 4 helper function that looks like this:
# this is in the application helper
def getRank(team_id, week = '')
if week.empty?
week = Settings.pluck(:week) # grab the current week
end
# do some stuff to get the current team's rank
end
When I call this in the console however I still get:
> helper.getRank(5)
ArgumentError: wrong number of arguments (1 for 2)
from /home/rails_testing/app/helpers/application_helper.rb:24:in `getRank'
What am I missing?