Project

General

Profile

Actions

Feature #5955

open

Hooks should provide all controller instance variables by default

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

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
2010-07-25
Due date:
% Done:

0%

Estimated time:
Resolution:

Description

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.

No data to display

Actions

Also available in: Atom PDF