# EDGE Rails, Erb Views, Confused

**URL:** <https://www.ruby-forum.com/t/edge-rails-erb-views-confused/118579>\
**Category:** Rails\
**Created:** [October 29, 2007, 5:40am UTC](https://www.ruby-forum.com/t/edge-rails-erb-views-confused/118579 "2007-10-29T05:40:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rawn027](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/d07c76/32.png) [@rawn027](https://www.ruby-forum.com/u/rawn027)\
**Post date:** [October 29, 2007, 5:40am UTC](https://www.ruby-forum.com/t/edge-rails-erb-views-confused/118579/1 "2007-10-29T05:40:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rawn027](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/d07c76/32.png) [@rawn027](https://www.ruby-forum.com/u/rawn027)\
**Post date:** [October 30, 2007, 4:38pm UTC](https://www.ruby-forum.com/t/edge-rails-erb-views-confused/118579/2 "2007-10-30T16:38:10Z")

</div>

On Oct 29, 12:39 am, Ronald V. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 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?
