Forum: Ruby on Rails Dynamically control Model.Save to use ActiveRecord or Action

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Jason V. (Guest)
on 2007-01-30 09:27
(Received via mailing list)
I have "requirement" to support a short term approach using
ActiveRecord.Save, but eventually migrate to a SOA environment.
Hence, I need to short-term with ActiveRecord and long-term with

Right now, I've got a Controller that looks like

class OfferRenewalController < ApplicationController
def handle_payment

    # Receive the ContractPayment "form fields" into an object
    @contract_payment =[:contract_payment])
    if (@contract_payment.valid?)


      # @contract_payment.errors.each_full { |msg| puts msg }
      render :action => 'take_payment', :id => @contract_payment

  end # handle_payment

class ContractPayment < ActiveRecord::Base

And this works great for the short-term.  How do I override the built-
in save method and conditonally use the "normal"ActiveRecord .save vs.
invoke some other WebService.  I tried a dozen things and just
confused the hell out of myself.  I would really appreciate a code
example with some explanation.

This topic is locked and can not be replied to.