# What is available to a Behavior?

**URL:** <https://www.ruby-forum.com/t/what-is-available-to-a-behavior/65062>\
**Category:** Radiant CMS\
**Created:** [August 15, 2006, 10:51pm UTC](https://www.ruby-forum.com/t/what-is-available-to-a-behavior/65062 "2006-08-15T22:51:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![smc7000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@smc7000](https://www.ruby-forum.com/u/smc7000)\
**Post date:** [August 15, 2006, 10:51pm UTC](https://www.ruby-forum.com/t/what-is-available-to-a-behavior/65062/1 "2006-08-15T22:51:51Z")

</div>

I’m working on a page behavior of my own and I’ve looked briefly at the  
delegation mechanism. Would I be correct in assuming that any method  
that  
is available to a Page is available in the Behavior methods that are  
delegated to? Specifically, I’d like to be able to manipulate the page,  
its  
parts and its children.

Sean C.  
[seancribbs.com](http://seancribbs.com)

---

<div class="post-metadata">

**Author:** ![smc7000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@smc7000](https://www.ruby-forum.com/u/smc7000)\
**Post date:** [August 15, 2006, 11:36pm UTC](https://www.ruby-forum.com/t/what-is-available-to-a-behavior/65062/2 "2006-08-15T23:36:55Z")

</div>

Sean C. wrote:

> I’m working on a page behavior of my own and I’ve looked briefly at the  
> delegation mechanism. Would I be correct in assuming that any method that  
> is available to a Page is available in the Behavior methods that are  
> delegated to?

No. Pages currently delegate the following methods to a behavior:

delegate\_to :behavior, :url =\> :page\_url, :cache? =\> :cache\_page?,  
:find\_by\_url =\> :find\_page\_by\_url, :render =\> :render\_page,  
:virtual? =\> :page\_virtual?

delegate\_to :behavior, :process, :child\_url

> Specifically, I’d like to be able to manipulate the page,  
> its parts and its children.

Not sure what you are doing, but you may end up having to override  
existing tags in order to get it to work. Behaviors are due for a  
refactoring.

–  
John L.  
[http://wiseheartdesign.com](http://wiseheartdesign.com)

---

<div class="post-metadata">

**Author:** ![smc7000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@smc7000](https://www.ruby-forum.com/u/smc7000)\
**Post date:** [August 15, 2006, 11:51pm UTC](https://www.ruby-forum.com/t/what-is-available-to-a-behavior/65062/3 "2006-08-15T23:51:58Z")

</div>

Well, maybe I could put it this way… is there a way to determine the  
page being processed from the request object passed to process\_page?  
All I need is to get an instance of the page, then I’ll be able to  
manipulate it however I like.

Sean C.  
[seancribbs.com](http://seancribbs.com)

P.S. Ok, ok, so I’ll spill the beans. I’m working on a behavior(s) that  
will allow comments to be posted as new (grand-)child pages.

---

<div class="post-metadata">

**Author:** ![smc7000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@smc7000](https://www.ruby-forum.com/u/smc7000)\
**Post date:** [August 16, 2006, 12:34am UTC](https://www.ruby-forum.com/t/what-is-available-to-a-behavior/65062/4 "2006-08-16T00:34:03Z")

</div>

Sean C. wrote:

> Well, maybe I could put it this way… is there a way to determine the  
> page being processed from the request object passed to process\_page?  
> All I need is to get an instance of the page, then I’ll be able to  
> manipulate it however I like.

You can change the find\_page\_by\_url method.

–  
John L.  
[http://wiseheartdesign.com](http://wiseheartdesign.com)
