Quoting Jeffrey L. Taylor <[email protected]>: > Quoting John Goewert <[email protected]>: > > 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 would do something different. Unless you can guarantee the the RSS server > is always up and there is never any congestion between the application server > and the RSS server (e.g., they are on the same machine or same LAN), I would > move the map update to run every 15 minutes. If it is run at the time of the > show request, it may take 30 seconds or more to timeout if the server is down. > If also may take a while to update the map model from the RSS feed. Is is > best for responsiveness if this is down outside the user request. > > I have been working on an adaptive RSS reader (AmethystRSS.net) for a while > and have found that updates can take longer than the user is willing to wait > and timeouts (i.e., no response in 30 seconds or whatever Ruby/Rails sets > timeout), 404 errors, 500 errors, etc. are common. Out of the 200+ feeds I > read, there are always some that are not fully functional at any given read. > An hour later (15 minutes in your case), they are fine. >
I am still wavering between making the RSS feed itself a non-ActiveRecord model versus adding the code to the related model, Map in your case. Maybe with the switch to ActiveModel in Rails3 it will become clearer. Jeffrey -- 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.

