Is it possible to make children inherit the behaviour of the parent?
For instance it would be nice for a blog site if all the children of
‘posts’ could automatically have a ‘comments’ behaviour.
I’m making a site where this functionality would come in handy.
What I’m also wondering if there’s a way to make default page_parts
for children. To stay with the blog example: children of ‘posts’
would have the ‘extended’ page_part by default, but other pages would
not.
jeroen janssen [email protected] wrote:
Is it possible to make children inherit the behaviour of the parent?
For instance it would be nice for a blog site if all the children of
‘posts’ could automatically have a ‘comments’ behaviour.
Yes, thats exactly what i need too… If its not possible i think it
should be added in the future…
Johannes Ziemke wrote:
jeroen janssen [email protected] wrote:
Is it possible to make children inherit the behaviour of the parent?
For instance it would be nice for a blog site if all the children of
‘posts’ could automatically have a ‘comments’ behaviour.
Yes, thats exactly what i need too… If its not possible i think it
should be added in the future…
Behaviors support the define_child_tags class method. So if all you want
to do is add tags that are accessible on the children, you can easily do
that like this:
class BlogBehavior < Behavior::Base
define_child_tags do
tag “hello” do
“hello world!”
end
end
end
Matt McCray made a plugin which adds support for Rails like before and
after filters which would give you the ability to make other changes to
child pages.
–
John L.
http://wiseheartdesign.com