Ruby on Rails controller-view refactoring

Posted by Dimitar Vouldjeff on Stack Overflow See other posts from Stack Overflow or by Dimitar Vouldjeff
Published on 2010-06-17T20:08:54Z Indexed on 2010/06/17 20:13 UTC
Read the original article Hit count: 259

Filed under:
|
|

Hello, In my app I am using the ym4r-gm plugin, which allows you to play with the Google Maps API... I put the map "setup" in the controller:

@map = GMap.new("div_map")
@map.control_init(:large_map => true, :map_type => true)
@map.center_zoom_init([47.0, 26.0], 7)
...

And only render @map in the view.

So my first question is whether I am using the right approach of "diving" this code? And the second question is: I have to models, which are rendering the same map (only the resources are different). Where should I put my refactored method that renders the map? In the application controller, maybe?

Thanks in advance, I hope you will understand me!

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about mvc