hi,

can anybody help me?
i wanna create a RoR monitoring application for my project.
i have a database with table named nodes
in that nodes i have id and ipadd.

here's my code:
#nodes_controller.rb

require 'net/ping'
include Net

class NodesController < ApplicationController
  def index
    @nodes = Node.find(:all)

    @arr_stat = Array.new
    i = 0
    for node in @nodes do

      stat = PingExternal.new(node.ipadd)

      @arr_stat[i]['ipadd'] = node.ipadd
      if stat
        @arr_stat[i]['status'] = 'online';
        puts "online"
      else
        @arr_stat[i]['status'] = 'offline';
        puts "offline"
      end
    end

    respond_to do |format|
      format.html { render :html => @arr_stat }# index.html.erb
      format.xml  { render :xml => @nodes }
    end
  end
##########################

why when i run the code it always says:

You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]=

please help me solved this.
-- 
Posted via http://www.ruby-forum.com/.

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

Reply via email to