G''day folks. My RentalMap model uses ym4r_gm to generate a Google map and plot markers on the map. However, a marker''s body contains HTML. It feels dirty to put HTML in the model, but the markers should be plotted by the model. Any suggestions for how I can move the marker HTML template out of the RentalMap model? Cheers, Nick --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi Nick,> G''day folks. My RentalMap model uses ym4r_gm to generate a Google map > and plot markers on the map. However, a marker''s body contains HTML. > It feels dirty to put HTML in the model, but the markers should be > plotted by the model. Any suggestions for how I can move the marker > HTML template out of the RentalMap model?I think something like the acts_as_renderer plugin maybe what you need: http://rubyforge.org/projects/actsasrenderer/ It allows you to render view output from inside a model - "Now you can violate MVC the easy way!" Regards, Tony. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Also... there''s some validity to the argument that a model''s domain might very well be creating markup and in such cases, HTML generation in the model could be quite justified. YMMV and HTH. :) RSL On Fri, Sep 5, 2008 at 5:05 AM, Tony Byrne <tonybyrne-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hi Nick, > >> G''day folks. My RentalMap model uses ym4r_gm to generate a Google map >> and plot markers on the map. However, a marker''s body contains HTML. >> It feels dirty to put HTML in the model, but the markers should be >> plotted by the model. Any suggestions for how I can move the marker >> HTML template out of the RentalMap model? > > I think something like the acts_as_renderer plugin maybe what you need: > > http://rubyforge.org/projects/actsasrenderer/ > > It allows you to render view output from inside a model - "Now you can > violate MVC the easy way!" > > Regards, > > Tony. > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 2008-09-05, at 05:05, Tony Byrne wrote:> Hi Nick, > >> G''day folks. My RentalMap model uses ym4r_gm to generate a Google map >> and plot markers on the map. However, a marker''s body contains HTML. >> It feels dirty to put HTML in the model, but the markers should be >> plotted by the model. Any suggestions for how I can move the marker >> HTML template out of the RentalMap model? > > I think something like the acts_as_renderer plugin maybe what you > need: > > http://rubyforge.org/projects/actsasrenderer/ > > It allows you to render view output from inside a model - "Now you > can violate MVC the easy way!" > > Regards, > > Tony.Thanks for the tip, Tony. I hadn''t heard about actsasrenderer. I''ll give it a try and see how it feels. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---