ActiveResource is supposed to be good for this sort of thing, isn't it?  Can 
you use that?

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of 
Nate Murray
Sent: Tuesday, October 14, 2008 1:16 PM
To: Ruby on Rails: Talk
Subject: [Rails] best-practice for programmatically using rxml generated from 
controller/view? (or 'how can I view a view from a model')


Hey Guys,

Here's the scenario:
I've got vendor-specific XML I need to create and then POST it somewhere. It 
sounds easy enough, but I'm running into issues when it comes time to actually 
use the XML.

Trying hard to stay within the MVC pattern I:

1) Create a controller which loads the models I'm about to turn into XML
2) Create an rxml view which renders the XML I need perfectly

Now I need to actually *use* this XML in a "model" and POST it to the 
webservice endpoint. Now, I am not asking "how can I render a view in a 
model?". What I am asking is "how can I view a view from a model?"

It seems logical and not a breach of MVC that the system should have this level 
of introspection (right?). It seems consistent with MVC b/c the view is 
rendering and the controller is controlling. I just need to use that view in an 
object.

The best solution I have right now is to just have an object that uses net/http 
or wget and then calls the url of my own server. But this seems hackish and 
less than ideal.

Has anyone else had to deal with a similar type of issue? Am I missing 
something incredibly obvious?

Nate


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to