Moving HTML out of a model

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

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.

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. :slight_smile:

RSL

Thanks for the tip, Tony. I hadn't heard about actsasrenderer. I'll give it a try and see how it feels.