Hi

I'm building an app at the moment where specific items can be added to
an order and then purchased through paypal.

Becuase the items are limited, it's important to relist them quickly
if the order is not completed within 5mins.

Anybody have any suggestions as to how I could go about this?

I was thinking of creating an observer for orders and including an
after_create like so:

Class OrderObserver < ActiveRecord::Observer

def after_create
  sleep 300 # sleep for 5 mins
  if self.status > 3 # anything above 3 should be saved
    return
  else
    self.items.each do |item|
      item.update_attribute :order_id, nil
    end
    self.destroy
  end
end

Is there a better or a standard way of doing this though?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to