Sometimes when building forms the rails way, you need to do some funky stuff to get your models prepped so they can be worked on in the controller.

For example, here I want to create a new subscription, but I need to first prep who the subscription is for, and what episode they want to subscribe to:

<%= form_for( do |f| %>
    <div><%= f.hidden_field :episode_id %></div>
    <%= f.submit "Secure Checkout", class: "btn btn-large btn-primary" %>
<% end %>

Which produces:

<form action="/subscriptions" id="new_subscription" method="post">

Then in my controller, if I really want the subscription to save itself I can:


For a good example see