title: How to use form input(s) in calculations?
body: <p>I am putting together a survey-submitting website, and I am giving visitors the option of specifying the time and date of a particular event they created:</p>
  
  <pre><code>&lt;table&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;%= text_field(:day,   "", placeholder: "DD")   %&gt;&lt;/td&gt;
      &lt;td&gt;&lt;%= text_field(:month, "", placeholder: "MM")   %&gt;&lt;/td&gt;
      &lt;td&gt;&lt;%= text_field(:year,  "", placeholder: "YYYY") %&gt;&lt;/td&gt;
  
      &lt;td&gt;&lt;%= text_field(:hour, "", placeholder: "HH") %&gt; : &lt;%= text_field(:minute, "", placeholder: "MM") %&gt; &lt;/td&gt;
      &lt;td&gt;&lt;%= radio_button_tag(:ampm, "AM") %&gt;&lt;/td&gt;&lt;td&gt;&lt;%= label_tag(:ampm, "AM") %&gt;&lt;/td&gt;
      &lt;td&gt;&lt;/td&gt;
      &lt;td&gt;&lt;%= radio_button_tag(:ampm, "PM") %&gt;&lt;/td&gt;&lt;td&gt;&lt;%= label_tag(:ampm, "PM") %&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>My Survey model has a :time_of_event attribute that holds a Time object which will represent the time specified by the user that fills out the form.  I intend to make use of Time.parse to create a Time object out of the 'YYYY-MM-DD HH:MM:00' that the user specifies.</p>
  
  <p>I have minimal experience using Rails forms - I can create basic text_field tags, and can save the input in those tags to a particular model's attribute upon submitting the form.</p>
  
  <p>How (if at all) can I go about calculating the input in form fields, and save that calculated result to a model's attribute?</p>
  
  <p>In other words, something that will probably end up looking like:</p>
  
  <pre><code>survey.time_of_event = Time.parse(form_params[:year] + '-' + form_params[:month] ...etc)
  </code></pre>