# Virtual-domain behaviour

**URL:** <https://www.ruby-forum.com/t/virtual-domain-behaviour/99763>\
**Category:** Radiant CMS\
**Created:** [July 25, 2006, 12:09pm UTC](https://www.ruby-forum.com/t/virtual-domain-behaviour/99763 "2006-07-25T12:09:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bodhi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/49beb7/32.png) [@bodhi](https://www.ruby-forum.com/u/bodhi)\
**Post date:** [July 25, 2006, 12:09pm UTC](https://www.ruby-forum.com/t/virtual-domain-behaviour/99763/1 "2006-07-25T12:09:22Z")

</div>

Hi All,

I’m just throwing together a virtual domain behaviour, eg map  
[dir.example.com](http://dir.example.com) internally to [example.com/dir/](http://example.com/dir/). I got a prototype  
working, but when adding the code to select a child page based on the  
host name I ran into a problem: I can’t see an easy way to get at the  
request object.

I thought about making Behavior::Base#process to check for parent  
behaviour, like in Behavior::Base#page\_url, but that doesn’t work as  
then the parent behaviour’s page would be rendered, not the correct  
child (unless i followed the code incorrectly). My next thought is to  
pass the request/response through when asking for the parent’s  
behaviour, but this does couple everything together a bit much. Another  
approach would be to make attr\_accessor()s on behaviours and fill them  
in after we get the parent page’s behaviour.

I’m going to try the attr\_accessor method, and see how far i get, but i  
was wondering to see what John and other people thought… Any  
comments?

Bodhi

---

<div class="post-metadata">

**Author:** ![bodhi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/49beb7/32.png) [@bodhi](https://www.ruby-forum.com/u/bodhi)\
**Post date:** [July 25, 2006, 12:12pm UTC](https://www.ruby-forum.com/t/virtual-domain-behaviour/99763/2 "2006-07-25T12:12:23Z")

</div>

On 25/07/2006, at 7:08 PM, bodhi wrote:

> Another approach would be to make attr\_accessor()s on behaviours and  
> fill them  
> in after we get the parent page’s behaviour.

Of course, as soon as I sent this email, I scrolled up and noticed that  
the accessors were already there (@\_@)

Bodhi

---

<div class="post-metadata">

**Author:** ![bodhi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/49beb7/32.png) [@bodhi](https://www.ruby-forum.com/u/bodhi)\
**Post date:** [July 25, 2006, 1:17pm UTC](https://www.ruby-forum.com/t/virtual-domain-behaviour/99763/3 "2006-07-25T13:17:14Z")

</div>

bodhi wrote:

> Of course, as soon as I sent this email, I scrolled up and noticed that  
> the accessors were already there (@\_@)

I have repeatedly had the same problem with this mailing list. Let me  
know if you find a workaround.

Jay
