# Mongrel handler and root\_handler

**URL:** <https://www.ruby-forum.com/t/mongrel-handler-and-root-handler/139126>\
**Category:** Mongrel\
**Created:** [May 31, 2008, 1:40am UTC](https://www.ruby-forum.com/t/mongrel-handler-and-root-handler/139126 "2008-05-31T01:40:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![epirsch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/a5b964/32.png) [@epirsch](https://www.ruby-forum.com/u/epirsch)\
**Post date:** [May 31, 2008, 1:40am UTC](https://www.ruby-forum.com/t/mongrel-handler-and-root-handler/139126/1 "2008-05-31T01:40:30Z")

</div>

Hi

I am writing my own handler and seeing some strance behavior. Best is  
describing by the following code

say I create mongrel server (see at the end of the email) and have one  
handler for the root (so shoudl handle all request…)  
To my surprise the @a in the following code in the Handlder is not the  
object I expect but a hash containing the name {:a =\> }

Looking right before the register is called, @a is correct… but  
looking inside the handler… suddenly it is all different… I  
cannot find any doc or why in the code it is behaving that way,…  
I am supposing this something due to how mongrel works but cannot  
figure out why

any help would be appreciated

Thanks

Manu

class MyServer  
def initialize( ip, port, log ,etc…)  
//saving all param in internal attributes  
…

```
@a = SomeObject.new

```

end

def start

```
server = Mongrel::HttpServer.new('localhost', 'port')
server.register("/", MyHandler.new(@a)

```

end  
end

Following is the handler code

class Myhandler \< Mongrel::HttpHandler  
def initialize(a, b, c)  
@a = a  
end

def process(request, response)  
// some code…

```
@a = > this is a hash and not the real object passed originally

```

end  
end
