net/ping now working

156 views
Skip to first unread message

Miguel Tubia

unread,
Jan 16, 2014, 5:04:21 PM1/16/14
to rubyonra...@googlegroups.com
Hi,

i'm developing a application using Rails 4. In my model I have a method
where i make a ping to a host on my network. I'm using 'net-ping' gem,
declared in gemFile, and Rails Server starts OK.
Well, when i use the gem, as in another apps on Ruby, I do:

Net::Ping::External.new @name

But i receive:

Completed 500 Internal Server Error in 168ms

NameError (uninitialized constant Net::Ping::External):
app/models/System.rb:169:in `checkSystem'
app/controllers/update_controller.rb:13:in `block in check_error'
app/controllers/update_controller.rb:12:in `check_error'

Searching on the Web I have tested the following:

require 'rubygems'
require 'net/ping'

But now the error is:

LoadError (cannot load such file -- net/ping):
app/models/System.rb:2:in `<top (required)>'
app/controllers/update_controller.rb:11:in `check_error'

I don't know how to debug this... Any idea/help?

Thanks!!
M.

--
Posted via http://www.ruby-forum.com/.

Matt Jones

unread,
Jan 18, 2014, 5:17:39 PM1/18/14
to rubyonra...@googlegroups.com
Did you run 'bundle' after adding net-ping to the Gemfile? The error above indicates that it's not installed...

--Matt Jones 

Miguel Tubia

unread,
Jan 19, 2014, 6:09:15 PM1/19/14
to rubyonra...@googlegroups.com
Hi,

thanks for your help. Yes, I did "bundle install".
Anyway, now it's solved. On my gemfile, i wrote "require 'net/ping'"
after the "gem 'net-ping', '~> 1.7.1'" entry, so now it's:

gem 'net-ping', '~> 1.7.1'
require 'net/ping'

With this, now it's working...

Thx!!
Reply all
Reply to author
Forward
0 new messages