How should I handle redirecting to pages from the model?
Basically I have credit cards that get processed in a model. If
successful, I want the user to be redirected to a certain page, of
unsuccessful I would like them redirected to a new page.
Obviously if I try and do this in the model, I get a undefined method
`redirect_to' error. How should I handle this?
a method in my model:
response = gateway.authorize(100, creditcard, options)
print "(TEST) " if response.test?
puts "The transaction was successful! The authorization is
redirect_to :controller => '/account', :action => 'index'
flash[:notice] = "Thanks for signing up!"
puts "The transaction was unsuccessful because
redirect_to :controller => '/account/', :action =>
flash[:notice] = "There was a problem with your credit card,
please verify your information and try again."
puts "The credit card is invalid"