Forum: Ruby on Rails Newby: Getting "unitialized constant SockServ" -- help

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
David T. (Guest)
on 2006-02-16 02:23
I can't seem to find my error.  I think it's fairly basic.  Do I have to
initialize SockServ somewhere or is this error message really indicating
something else?

uninitialized constant SockServ


This error occured while loading the following files:

This is in my ApplicationController (partila)
    def get_reordered_images
      # eventually send in image IDs, for now, send in nothing, just get
      @response = SockServ.open_send_receive
      # now unwrap XML response, and create list of image IDs to display
      render(:layout => false)

This is in my apps/models directory (sockserv.rb)
class SockServ

    def initialize

    def self.open_send_receive
       # open a socket here and send the data in the xml var
       # read from the socket the response and use it as the return
    require "socket"

    # s is an instance of a socket
    @socket ="nnn.nnn.nnn.n", 9000)

# sending xml to just opened socket (send is std call)
    @xml = "<?xml version="1.0" ?>
    	     <version> 2.0 </version>
       	  	   <mode> pbir </mode>
          			<resultImageSize> 16 </resultImageSize>

Jens-Christian F. (Guest)
on 2006-02-16 22:37
(Received via mailing list)
> This is in my apps/models directory (sockserv.rb)
> class SockServ

try to move this class to lib/sockserv.rb

then in your controller:

     require 'sockserv'

This topic is locked and can not be replied to.