Andrew Pace wrote: > Sorry about above. The post should be: > > I want to use logical models to aggregate data to present information > to the user. For example, I might have a controller that looks like > the following: > > class OrdersController < ApplicationController > def new > @order = Order.new > @address = Address.new > end > end > > What I would prefer to have is: > > class OrdersController < ApplicationController > def new > @logical_order = LogicalOrder.new > end > end > > Logical Order would look like (NOT and ActiveRecord model): > > class LogicalOrder > def order > @order ||= Order.new > end > > def address > @address ||= Address.new > end > > def save > address_saved = address.save > order_saved = order.save > address_saved && order_saved > end > end > [...] > Since this model is not an > active record model, how can I implement the save method such that it > is wrapped in a transaction. I have thought about pushing the save > logic back into one of the active record models (like the Order > model), but I would prefer to do it within this class. Any thoughts?
Just call the transaction from within your LogicalOrder code. What's the problem? > > Thanks, > > Andrew Best, -- Marnen Laibow-Koser http://www.marnen.org [email protected] -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

