From: leon breedt Date: 2004-07-26T17:20:55+09:00 Subject: aop presentational items in Rails? hi, i was just wondering, does Rails offer, or plan to offer, HTML::Mason-like AOP for templates? the Masonic notion does not map directly to the Rails way of doing things, i suspect, i think the closest thing Rails has to a component in Mason terminology is the template, and i'll use template below when i mean "component" in HTML::Mason terms. with HTML::Mason, you can define a "autohandler" for any particular path. what this means is that the autohandler is a parent (for the purposes of presentational output) for any template contained at or below that path. it has complete control of the output and can decide where the output of any contained templates should go. you can obviously override it selectively for components that you don't want this behaviour to apply to. the concept is very powerful though, as the wrapped component need know nothing about how its being wrapped. this is also vastly superior to include mechanisms, as it is completely DRYish :) Mason examples: /autohandler - gets invoked for all paths /admin/autohandler - gets invoked for everything below /admin there is of course also the Mason concept of "dhandler", or "default handler", when nonexistent paths are attempted to be accessed, but thats a whole different discussion. the autohandler feature is something i would not be able to live without though, as it has meant a vast reduction in LOC for my web apps. comments? leon