Colin Law wrote in post #1183946:
On 12 June 2016 at 08:55, David Alejandro wrote:
want this. I only want the attribute updated if the link is clicked.
follows the URL generated by the method.
Well that is what you need to fix. If you need to do something to the
database then you need to call an action in your application that does
whatever it is you want to do. If necessary you can then redirect to
your external url.

Are you a beginner with Rails? If so then I suggest that before going
further you work right through a good tutorial such as (which is free to use online), that will show you
the basics of Rails.

Managed to solve this a while ago :-)

I created an action for the link which generates and follows the link,
then when it gets back from it (PayPal), it updates the database.

   post 'orders/:id/pay', to: 'orders#start_payment_process', as:

     <%= link_to "Pagar en PayPal", start_payment_process_path, class:
"btn btn-success", method: :post %>

   def start_payment_process
     @order = current_order
     @order.update_attribute(:payment_in_process, true)
     redirect_to @order.paypal_url(edit_order_url,

   def edit
     # ... Some code
     if @order.payment_notifications.any? && @order.payment_in_process
       @order.update_attribute(:payment_in_process, false)


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


Related Discussions

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



site design / logo © 2021 Grokbase