A user has the ability to edit their credit card information, like so:
CreditCardsController:
class CreditCardsController < ApplicationController
before_filter :authenticate_user!
respond_to :js
def edit
@cc = current_user.credit_cards.where(:id => params[:id]).first
respond_with @cc
end
end
_form.html.erb:
<%= form_for @cc, :remote => true, :html => { :method => :put } do |f| %>
<div id="cancel-subscription" class="modal-content">
<div class="header dotted-border">
<h2>Billing Information</h2>
<p>Edit the fields below to update your information</p>
</div>
<div class="content dotted-border">
<h2>Credit Card</h2>
</div>
</div>
<% end %>
For some reason the form_foris ignorning the :method option even if I leave it off. It keeps getting set to post. That is not correct since I am editing/updating a CC entry. Anyone else run into this issue?
Just adding
:html => { :method => put }
will not work, because form_for generate _methode hidden element with form on update and delete.
just using
:method => "put"
in form may work
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With