EDGE Rails, Erb Views, Confused

I have been working with rails on and off for a while now. I still consider myself a noob with rails. Now with EDGE rails I am quite lost. I am using the Preview Release right now. My database migrations are quite sexy. I am just having the following trouble.

Right now I have started development of a snmp monitor app which will just be used for in house, for now.

I want to add another link in the show view called "Walk" which will run an SNMP walk on the IP that is provided in the box. How would I go about doing that. Would the snmp commands get run via the model or the controller?

Thanks -Ron

I would create a model that will run your snmpwalk and parse the results into some sort of object or a collection of objects. Then, you would call that from your controller.

For example:

Say you have a processes controller with a show method. It calls the SystemProcess model, which is simply something you wrote to walk the process tree and put that into an array of Process objects.

(This below is for MERB, not Rails, but its very similar. I think you can get the point of it.)

    def show       begin         @process = SystemProcess.find_by_host(params[:hostname])       rescue Exception => e         raise NotFound.new(e.message)       end       if params[:process]         @process = @process.select {|s| Regexp.new(params[:process],true).match( s.name) }       end       respond_to do |f|         f.txt { render_no_layout }         f.xml { render }         f.html { render }       end     end

So, that returns to you an @process object, which you can then render in your views. If there was a process param passed, then we will go through the collection of processes and only keep ones that match whatever regex was passed.

That helpful?