ChiliProject is not maintained anymore. Please be advised that there will be no more updates.

We do not recommend that you setup new ChiliProject instances and we urge all existing users to migrate their data to a maintained system, e.g. Redmine. We will provide a migration script later. In the meantime, you can use the instructions by Christian Daehn.

New Hook (Feature #1149)


Added by Nicolas Paez at 2012-09-20 01:37 pm. Updated at 2012-09-20 06:29 pm.


Status:Ready for review Start date:2012-09-20
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:-
Target version:-
Remote issue URL: Affected version:

Description

At this moment there is a controller_timelog_edit_before_save hook but
I would like to have a similar hook but for AFTER case. It would be something like: controller_timelog_edit_after_save.


Associated revisions

Revision b1a8790a
Added by Jean-Philippe Lang at 2008-06-14 05:44 pm

File size display with Bazaar repositories (#1149).

git-svn-id: http://redmine.rubyforge.org/svn/trunk@1537 e93f8b46-1217-0410-a6f0-8f06a7374b81

History

Updated by Nicolas Paez at 2012-09-20 05:59 pm

I have implemented it in my environment.
I just added two lines of code (it fact is just one line in to places)

  • Line to add: call_hook(:controller_timelog_edit_after_save, { :params => params, :time_entry => @time_entry })
  • File to add it: timelog_controller.rb
  • Place to add it: right below if @time_entry.save

Updated by Nicolas Paez at 2012-09-20 06:02 pm

  • Status changed from Open to Ready for review

Updated by Holger Just at 2012-09-20 06:20 pm

Why don't you simply use the after_save hook of the TimeEntry model which is provided by Active Record?

Generally, I'd like to deprecate/remove all hooks, but foremost the controller hooks. They are just not the right kind of technology for the task and a PITA to maintain.

Updated by Nicolas Paez at 2012-09-20 06:29 pm

Two reason lead me to this approach:

  1. The hooks are mentioned in the documentation as an standard extension mechanism
  2. The hook provides me more information

I think that if you plan to remove hooks support, you should mention it in the documentation.

Also available in: Atom PDF