Rails already provide several form helpers for our ease of use.
The latest addition is
weekday_helper that provides a nice select dropdown
We can also use
The above will result in
Rails 7 adds weekday_select and weekday_options_for_select helper
to render the select dropdown with weekdays.
Let’s look into the
the available options we can pass to it.
NOTE: Provide the correct default based on the values
- If the
index_as_value is set to true the selected value should be between
:day_format is set to
:abbr_day_names default should be set accordingly (
- Returns options with index as value (
:abbr_day_names for abbreviated week days.
we can also add custom days in