Skip to content

Instantly share code, notes, and snippets.

@PeteMichaud
Created June 28, 2012 21:52
Show Gist options
  • Select an option

  • Save PeteMichaud/3014201 to your computer and use it in GitHub Desktop.

Select an option

Save PeteMichaud/3014201 to your computer and use it in GitHub Desktop.

Revisions

  1. PeteMichaud created this gist Jun 28, 2012.
    11 changes: 11 additions & 0 deletions request
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    {"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"}
    11 changes: 11 additions & 0 deletions view
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    <%= 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 %>