プロジェクト

全般

プロフィール

Vote #67688

未完了

Hooks should provide all controller instance variables by default

Admin Redmine さんが約2年前に追加.

ステータス:
New
優先度:
通常
担当者:
-
カテゴリ:
-
対象バージョン:
-
開始日:
2010/07/25
期日:
進捗率:

0%

予定工数:
category_id:
0
version_id:
0
issue_org_id:
5955
author_id:
2784
assigned_to_id:
0
comments:
0
status_id:
1
tracker_id:
2
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[New]

説明

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.

表示するデータがありません

他の形式にエクスポート: Atom PDF

いいね!0