Alexander Farley wrote in post #1072914: > I'd like to render a nested hash as a tree SVG inside a view. It's > becoming cumbersome to write the hash traversing inside the view. > > Is the appropriate location for the SVG generation inside a controller? > If so, should I respond_to formal.xml? I would then call the SVG > generation action from inside the view. > > I know there are various ways of doing this, I'm just curious what the > standard choice is.
Not knowing all the details of what you're doing, I would most likely separate the SVG generation code entirely from both the view and the controller. SVG is a graphic. I would treat it as an object (or object graph) unto itself. Your controller would then ask for the data (i.e. the SVG rendering code) and update the view. That's the responsibility of the controller, nothing more. -- Posted via http://www.ruby-forum.com/. -- 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@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.