Help with a select_tag; getting an undefined method `stringi


I’m trying to use a select_tag in the following manner:

<%= select_tag(:received_at, @select_dates, String(params[:received_at])
) %>

But I get this error:

undefined method `stringify_keys’ for “”:String

Removing the third parameter eliminates the error, but I was hoping
that the drop-down list will select whichever string in the drop-down
list matches params[:received_at].

Thanks in advance!


For the benefit of someone searching through this list, my
implementation of the below was wrong. I needed to use

So, it should have been:

<%= select_tag(:received_at, options_for_select(@select_dates,
@params[:received_at])) %>