David T-L
2006-Feb-16 00:23 UTC
[Rails] Newby: Getting "unitialized constant SockServ" -- help
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 C:/rails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:200:in `const_missing'' #{RAILS_ROOT}/app/controllers/mindreadr_controller.rb:15:in `get_reordered_images'' This error occured while loading the following files: sock_serv.rb This is in my ApplicationController (partila) def get_reordered_images # eventually send in image IDs, for now, send in nothing, just get images @response = SockServ.open_send_receive # now unwrap XML response, and create list of image IDs to display render(:layout => false) end This is in my apps/models directory (sockserv.rb) class SockServ def initialize end 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" STDOUT.flush # s is an instance of a socket @socket = TCPSocket.open("nnn.nnn.nnn.n", 9000) # sending xml to just opened socket (send is std call) @xml = "<?xml version="1.0" ?> <transaction> <version> 2.0 </version> <ctrl> <mode> pbir </mode> <option> <resultImageSize> 16 </resultImageSize> </option> </ctrl> </transaction>" @socket.send(@xml) @socket.recv end end -- Posted via http://www.ruby-forum.com/.
Jens-Christian Fischer
2006-Feb-16 20:35 UTC
[Rails] Newby: Getting "unitialized constant SockServ" -- help
> > 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'' hth jc -- InVisible GmbH, Langgr?tstrasse 172, 8047 Z?rich Phone: +41 44 401 09 30 http://www.invisible.ch http://not.invisible.ch -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2361 bytes Desc: not available Url : http://wrath.rubyonrails.org/pipermail/rails/attachments/20060216/6e35d5b1/smime-0001.bin