Nate Murray
2008-Oct-14 20:15 UTC
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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Pardee, Roy
2008-Oct-14 20:42 UTC
Re: best-practice for programmatically using rxml generated from controller/view? (or ''how can I view a view from a model'')
ActiveResource is supposed to be good for this sort of thing, isn''t it? Can you use that? -----Original Message----- From: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org [mailto:rubyonrails-talk@googlegroups.com] 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2008-Oct-14 20:45 UTC
Re: best-practice for programmatically using rxml generated from controller/view? (or ''how can I view a view from a model'')
Use builder directly (which is what rxml views use) Sent from my iPhone On 14 Oct 2008, at 21:15, Nate Murray <nmurray-gGupoRlFWKc4HrseOoyPog@public.gmane.org> wrote:> > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---