Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Correct way to use DRb within a Rails Controller?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
x1  
View profile  
 More options Dec 13 2005, 10:59 pm
Newsgroups: comp.lang.ruby
From: x1 <caldri...@gmail.com>
Date: Wed, 14 Dec 2005 12:59:56 +0900
Local: Tues, Dec 13 2005 10:59 pm
Subject: Correct way to use DRb within a Rails Controller?
[not really rails specific]
I'm unsure about what should be placed where or if it even matters.
Here's the basic rails controller:

-------please_work_controller.rb----------
class PleaseWork < ApplicationController
    def get_name
       @name = retrieve.name
    end
    def get_age
       @age = retrieve.age
    end
end
-------/please_work_controller.rb--------
To create your typical client DRb connection, you'll need the following:

    require 'drb'
    DRb.start_service
    retrieve = DRbObject.new(nil,"druby://#{hostname}:#{port}")

Where should these definitions be placed? They seem to work just about
anywhere but whats the optimal placement? Also, I realize retrieve
does not *need* to be defined but since it is used throughout the
class in other methods as such..

Thanks as usual!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Eric Hodel  
View profile  
 More options Dec 14 2005, 9:30 pm
Newsgroups: comp.lang.ruby
From: Eric Hodel <drbr...@segment7.net>
Date: Thu, 15 Dec 2005 11:30:53 +0900
Local: Wed, Dec 14 2005 9:30 pm
Subject: Re: Correct way to use DRb within a Rails Controller?
On Dec 13, 2005, at 7:59 PM, x1 wrote:

Depending upon how long your DRb server lives you can probably make  
retrieve a global and put it in environment.rb.  Score bonus points  
for using NamedIdConv.

> Where should these definitions be placed? They seem to work just about
> anywhere but whats the optimal placement? Also, I realize retrieve
> does not *need* to be defined but since it is used throughout the
> class in other methods as such..

> Thanks as usual!

--
Eric Hodel - drbr...@segment7.net - http://segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
x1  
View profile  
 More options Dec 16 2005, 10:27 pm
Newsgroups: comp.lang.ruby
From: x1 <caldri...@gmail.com>
Date: Sat, 17 Dec 2005 12:27:55 +0900
Local: Fri, Dec 16 2005 10:27 pm
Subject: Re: Correct way to use DRb within a Rails Controller?
The reason I asked this originally, was because webrick would just
come to a halt after about 10-15 http requests..

After eliminating ram/cpu/gc as the culprit, I did a netstat -a and
found loads of open sessions....

Removing DRb.start_server from the controller all together -fixed it.

On 12/14/05, Eric Hodel <drbr...@segment7.net> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »