When I create an object with a form_for and put a select_tag inside it, I expect the selected value to go to params as a hash inside the model hash, e.g. params[:model][:attribute1], since this is how really basic forms with text fields have behaved for me in the past. Not the case here:
<%= form_for(@vote, url: judgment_votes_path(@vote.judgment)) do |i| %>
<%= select_tag(:yayornay, options_for_select(%w[yes no undecided stand_aside])) %>
<div class='actions'>
<%= i.submit 'Save vote' %><br />
</div>
<% end %>
Above gives me a params[:yayornay]. Apidock’s entry on form_for has revealed little to dispel my confusion. Is there an easy way to structure my select_tag params like params[:vote][:yayornay], so that everything’s nice like old times?
You are using the select_tag helper, which simply makes the select tag syntax a bit easier to use. Check out the form helpers here: http://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html for select tags that correspond to an object (such as :vote in your case). You can use the select helper either like select(:vote, :yayornay, …) or i.select(:yayornay, …)
FYI, it’s more common to use ‘f’ as the form object, not ‘i’.