What is available to a Behavior?

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

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

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

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.

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs