Re: [Rails] state_machine prevents ActiveRecord from being persisted

2013-12-03 Thread Rick
It sounds like you're in a tangle between FSM states and ActiveRecord states. You might need to add a payment_queued state that forces an AR save before transitioning to do_pay. You could then add some logic that fires a loop back to through do_pay (retry n times after increasing timeout) bef

Re: [Rails] state_machine prevents ActiveRecord from being persisted

2010-01-28 Thread Marcelo de Moraes Serpa
Hi Joel, thanks for the reply. The system is working well. My problem is with the state_machine gem. If the payment fails, I can't really get it saved without doing the hack I mentioned, becase the state_machine implementation rollback any db transaction when you return false from an event, howeve

RE: [Rails] state_machine prevents ActiveRecord from being persisted

2010-01-27 Thread Joel Dezenzio
What type of payment system are you using? IPN? If so, then once the payment reaches the payment gateway and the customer finishes paying, you check the status of the payment received and if successful, you change the subscription based off the amount(s) received. You are supplying information bu

[Rails] state_machine prevents ActiveRecord from being persisted

2010-01-26 Thread Marcelo de Moraes Serpa
Hello list, I have a subscription model that has a upgrade event. This changes the state from free->paying and triggers a charge method in the subscription model. This charge method then creates a new instance of the payment model (just in memory, using .new), and triggers the pay event on it. The