I wrote a simple integration test code and was addicted to it, so I will leave it as a memorandum. I would appreciate it if you could point out any mistakes.
<%= raw sprintf(
    form.date_select(
      :birthday,
      class:'select-birth',
      id:"birth-date",
      use_month_numbers: true,
      prompt:'--',
      start_year: 1930,
      end_year: (Time.now.year - 5),
      date_separator: '%s'),
"
Year </ p>", "
Month </ p>") + "
Day </ p>"%>
I was worried because I couldn't select the elements as I wanted in the form for selecting the year, month, and day, but the following article was helpful.
In conclusion, when I verified with a browser and checked the element I wanted to specify, the name attribute was properly assigned one by one, so describe it as it is
select '1930',from: 'dear_person[birthday(1i)]'
  select '12',from: 'dear_person[birthday(2i)]'
  select '12',from: 'dear_person[birthday(3i)]'
I passed here safely. It's completely my mistake.
Recommended Posts