【发布时间】:2016-10-12 18:56:08
【问题描述】:
我在视图中有这个链接:
<%= link_to "Pay in PayPal", @order.paypal_url(edit_order_url, payment_notification_url), class: "btn btn-success" %>
模型中的这个:
class Order < ActiveRecord::Base
def paypal_url(return_url, notify_url)
# ... Do stuff
self.update_attribute(:payment_in_process, true)
# Do more stuff...
end
当我访问 视图 时,模型会更新其属性。我不想要这个。我只希望在单击链接时更新属性。
知道如何做到这一点吗?
【问题讨论】:
标签: ruby-on-rails paypal model