Support Requests: Browse | Submit New | Admin

[#11344] Can't user win32-service inside of a Rails application

Date:
2007-06-04 10:21
Priority:
3
Submitted By:
Roberto V. A. (robo)
Assigned To:
Nobody (None)
Category:
win32-service
State:
Closed
Summary:
Can't user win32-service inside of a Rails application

Detailed description
Hi,

I'm trying to get win32-service to work on Rails. 

When I open up a console and do the following it works:

require "win32/service"
include Win32
@services = Service.services
puts @services.first

=> => #<struct Struct::Win32Service service_name="Abiosdsk", display_name="Abiosdsk",
service_type="kernel driver", current
_state="stopped", controls_accepted=nil, win32_exit_code=1077, service_specific_exit_code=0, check_point=0,
wait_hint=0,
 binary_path_name=nil, start_type="disabled", error_control="ignore", load_order_group="Primary
disk", tag_id=3, start_n
ame=nil, dependencies=nil, description=nil, :interactive?=false, pid=0, service_flags=0>

If I do the same inside a Rails controller like this it dies:

gem "win32-service"
include Win32
class ServicesController < ApplicationController

  def index
    list
    render :action => "list"
  end

  def list

    # Enumerate over all services, inspecting each struct
    @services = Service.services  
  end
end

The Error Message is as follows:

 NoMethodError in ServicesController#list

undefined method `services' for Service:Module


I tried to use gem "win32/service" but it is no better. Google didn't help me either.

Any Suggestions?

Thanks in Advance,

Roberto

Add A Comment: Notepad

Please login


Followup

Message
Date: 2014-01-10 15:48
Sender: Daniel Berger

No followup, closing.
Date: 2008-07-07 20:51
Sender: Daniel Berger

Any luck with this?

Dan
Date: 2008-02-22 01:38
Sender: Daniel Berger

Namespace issue perhaps? Don't include Win32 and try
Win32::Service.services explicitly.

Does that help?

Regards,

Dan

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

Field Old Value Date By
close_date2014-01-10 15:482014-01-10 15:48djberg96
resolution_idNone2014-01-10 15:48djberg96
status_idOpen2014-01-10 15:48djberg96