用户可以编辑他们的信用卡信息,如下所示:
信用卡控制器:
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 %>
出于某种原因,即使我将其关闭,它也会form_for
忽略该选项。:method
它一直设置为post
. 这是不正确的,因为我正在编辑/更新 CC 条目。还有其他人遇到这个问题吗?