Im trying to decide the best way to implement an interface to
quickbooks using xml.
class Timecard < ActiveRecord::Base
after_create :quickbooks_add_timecard #this method calls
the thing is that I thought it was gonna work out great, I could put
all my xml templates in a views directory and have everything nice and
organized. The problem is that It seems like this operation should be
triggered from model callbacks, and I would lilke to put somethign like
this in the quickbook.rb model:
class Quickbook < ActiveRecord::Base
request_xml = render_to_string :template =>
I see 3 options:
1.) move this callback logic out of the model and put it in the
controller in the first place.
2.) use Builder::XmlMarkup directly in the model, to generate an xml
request strig, loading the templates directly,
3.) Figure out how to get a rendered template from within the model
(like shown above)
Option 3 seems the cleanest to me, it just goes against my normal
conventions of putting data model rules in the model. I'd like to
figure out how to do #3 in any case.
The only problem with this is Im not sure