Feature #5955

Hooks should provide all controller instance variables by default

Added by Holger Just over 12 years ago. Updated over 12 years ago.

Status:NewStart date:2010-07-25
Priority:NormalDue date:
Assignee:-% Done:


Target version:-


Currently, many hook calls provide some of the instance variables of the respective controller instance to the hook (plus some additional data). In #5932, it was shown again, that this data is often not sufficient.

A "common" pattern is to use context[:controller].instance_variable_get("@my_var") which is rather hacky from an API point of view. It would be better if by default all instance variables of the controller could be provided to the hook.

The best implementation would probably be by providing a proxy object to the hook. That way, the usage would not be restricted much but could provide a much cleaner API. Another possibility would be to copy some of the logic from the variable passing from the controller to the view.

Also available in: Atom PDF