The error is coming because of your prompt value. The date helper is looking for a hash of prompt values and you are passing it a Date object which the helper sees as a hash with indifferent access meaning it doesn't have a method like your_prompt_hash.day
.
See the example on the Date helper page you linked to:
# Generates a date select with custom prompts.
date_select("article", "written_on", prompt: { day: 'Select day', month: 'Select month', year: 'Select year' })
What you're looking for is :default
such as:
= f.date_select :dob, { start_year: 100.years.ago.year, end_year: Date.today.year, default: Date.today}
Or you can set this in your controller like:
def new
@your_model = YourModel.new
@your_model.dob = Date.today
end
Or you can set the default value for dob in your model like:
class YourModel < ActiveRecord::Base
after_initialize :set_defaults
private
def set_defaults
self.dob ||= Date.today
end
end
Either the model or controller solutions would allow you to omit the default value from the date_select call.