Skip to content

Instantly share code, notes, and snippets.

@PeteMichaud
Created June 28, 2012 21:52
Show Gist options
  • Save PeteMichaud/3014201 to your computer and use it in GitHub Desktop.
Save PeteMichaud/3014201 to your computer and use it in GitHub Desktop.
{"utf8"=>"✓",
"_method"=>"put",
"authenticity_token"=>"...",
"user"=>{"email"=>"email@email.com",
"password"=>"[FILTERED]",
"first_name"=>"Bob",
"last_name"=>"Jones",
"subscription"=>{"plan_id"=>"5"}},
"password_confirmation"=>"[FILTERED]",
"commit"=>"Update User",
"id"=>"2"}
<%= f.fields_for @user.subscription_attributes do |fs| %>
<div class='control-group<%= " error" if @user.subscription.errors.has_key?(:plan_id) %>'>
<label class='control-label'>Plan</label>
<div class='controls'>
<%= fs.select :plan_id, @plans.map {|p| [p.plan_name, p.id] } %>
<% if @user.subscription.errors.has_key?(:plan_id) %>
<span class='help-inline'>Plan <%= @user.subscription.errors.get(:plan_id).first %></span>
<% end %>
</div>
</div>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment