Actionwebservice/activerecord question

Wasn’t sure what subject best described what I need. I have a
webservice that returns a struct CustomerRec that contains a customer
and the customer’s transactions and subscriptions. However, I want to
make the transactions and subscriptions optional. It’s easy enough to
just not fill the subscriptions and transactions members of
CustomerRec, but the Customer query still loads the associations which
is not necessary if I’m not returning them. If I could just create a
class like CustomerWithoutAssociations that did not have the
associations and use it in place of Customer that would work, but
Customer is already defined as a member of CustomerRec, so that won’t
work. Can I redefine members of CustomerRec at runtime? Other

class CustomerRec < ActionWebService::Struct
member :subscriptions, [Subscription]
member :transactions, [TransactionRec]
member :customer, Customer

class Customer < ActiveRecord::Base

has_many :txns, :foreign_key => ‘customer_id’
has_many :subscriptions, :foreign_key => ‘customer_id’

Can I redefine members of CustomerRec at runtime?

I forgot that won’t work either. the customers member of CustomerRec
needs to be Customer, because that’s what will be defined in the wsdl.

So far the only way I have thought of to do this is to define
additional api methods that return a different struct. But there are
40 base methods, and for each method I want 4 options as follows.
That’s 120 additional api methods which is kind of crazy.

  1. Return customer with no associations
  2. Return customer with subscriptions
  3. Return customer with transactions
  4. Return customer with subscriptions and transactions