Colin Law wrote in post #1183944:
On 12 June 2016 at 08:03, David Alejandro wrote:
class Order < ActiveRecord::Base
def paypal_url(return_url, notify_url)
# ... Do stuff
self.update_attribute(:payment_in_process, true)
# Do more stuff...

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?
Separate out the code that generates the url from the code that
updates the database. Then run the update in the action that is
called when the link is clicked.

Colin, there's no action called when the link is clicked, it just
follows the URL generated by the method.

Tried separating the URL generator and creating an action but it turns
out to be the same...

Posted via

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
To post to this group, send email to
To view this discussion on the web visit
For more options, visit

Search Discussions

Discussion Posts


Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 5 of 7 | next ›
Discussion Overview
grouprubyonrails-talk @
postedJun 12, '16 at 7:03a
activeJun 12, '16 at 12:21p



site design / logo © 2021 Grokbase