I have this link in the view:


       <%= link_to "Pay in PayPal", @order.paypal_url(edit_order_url,
payment_notification_url), class: "btn btn-success" %>


And this in the model:


      class Order < ActiveRecord::Base
      def paypal_url(return_url, notify_url)
         # ... Do stuff
         self.update_attribute(:payment_in_process, true)
         # Do more stuff...
       end

When I visit the view, the model gets its attribute updated. I do not
want this. I only want the attribute updated if the link is clicked.

Know how to accomplish this?

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/40a63abd3f759f1c0a3a39810161b0db%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 7 | next ›
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedJun 12, '16 at 7:03a
activeJun 12, '16 at 12:21p
posts7
users3
websiterubyonrails.org
irc#RubyOnRails

People

Translate

site design / logo © 2021 Grokbase