On 5 March 2010 21:56, John Goewert <[email protected]> wrote: > I have an app that I am trying to generate out some GoogleMaps. The > GoogleMaps aren't the problem, I am tripping over the proper way to > handle what I want to do. > > I have a DB for map markers. > > Path 1: > When the user makes a call to the controller => "mymap", action => > "show", I grab the id parameter. > From here, if 15 minutes have passed since it was last checked, I make > a call to a function check_map_update that makes an RSS call to an > outside repository and puts the changes in the map marker DB. Show > then goes on to read the map markers and generate a map shown by the > view. > > Path 2: > In my view, I want it to pull up some thumbnails of other maps, so I > make a helper called "show_thumbnail", which I put a <% render %> call > in that returns the image to display. > > MapController > def show > def check_map_update > > MapHelper > def map_thumbnail > > View: > Application.html.erb > map/show.html.erb > > My Problem: > I want to be able to call check_map_update from the function in the > helper. Or, is the helper the best place for this? render partial > seems to be little help since it doesn't run controller code either. > What I really would have liked to have is a controller that calls a > couple other actions like show/1, show/53, and includes those as part > of the page, but I can't quite figure out the proper place for that > and I can't find a tutorial or decent document that says how to do it. > > My current thought is that check_map_update should be in the map > model. But how would I go about showing multiple maps from the > controller?
I am not sure whether this will help or not but is it possible that the underlying cause of the problem is that you are generating the map in the controller? A map is after all a view on some data so arguably should be generated in the view. If in the controller you just setup whatever variables are required to define the map parameters, markers and so on, and move the map generation to the view (with actual code in the model or helpers of course) things might work out easier. In the particular case you mention the controller would just need to define that maps 1 and 53 should be shown and the view would show them. Colin -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

