Hi Daniel,
Interesting point. But let’s look at this from another perspective
rather than @title. In your component template, if you access
controller.controller_name or controller.action_name what should you
see? Since you are in the component controller, I would argue that
you should see things from the perspective of the component
controller.
As well, since components appear to be intended to be isolated siloes
of functionality, having the @title use the @title from it’s parent
context would not use normal OO inheritance, but would use some sort
of runtime context inheritance. From that perspective it seems a
little difficult to articulate how it would work in all cases (what it
would get from where and when), and increases the coupling between the
component and it’s surroundings.
I had my own issues with components a few days ago that were never
resolved and left me abandoning the use of components.
Could you explain your own situation a bit more to explain why you
want to use the @title from your original controller inside the
component? It would help me look at my own situation from another
context.
I ask because it appears that people don’t seem to use components.
I was trying to call a component from within another component (a
sidebar with various constituent pieces in the sidebar), but doing
this was causing a ruby core dump for me. All the IRC and mailing
list questions I posted never got a reply. It almost appeared that
people aren’t using components, and I was hitting on a relatively
simple bug simply because people don’t use them. I made a bug report
and haven’t heard anything further.
http://dev.rubyonrails.org/ticket/4152
Good luck,
Brad
Bradley M.