Forum: Ruby on Rails best-practice for programmatically using rxml generated from controller/view? (or 'how can I view a

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
A8798e4cbafc5e2ac4ac6a82a32d5eee?d=identicon&s=25 Nate Murray (Guest)
on 2008-10-14 22:16
(Received via mailing list)
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
D6434aa0b7b350f8c3ed0119d81b2ead?d=identicon&s=25 Roy Pardee (rpardee)
on 2008-10-14 22:43
(Received via mailing list)
ActiveResource is supposed to be good for this sort of thing, isn't it?
Can you use that?
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2008-10-14 22:47
(Received via mailing list)
Use builder directly (which is what rxml views use)

Sent from my iPhone
This topic is locked and can not be replied to.