Vote #64071
完了Hook issue in some places of redmine
100%
説明
I'm with a problem with hook api, i made a plugin to make time_entry accept other fields like start hour, end hour and break time instead only hours, in the issue view, the hook works very nice in view and in controller, than i was trying to change in time log too, the view works fine, but when i put the hook in controller i get a error, i all ready tried to call a empty hook call_hook() and i get error....
@Processing TimelogController#edit (for 127.0.0.1 at 2008-10-30 09:39:31) [GET]
Session ID: f71a27b45be5f23aeb42c0cb88dc20b4
Parameters: {"action"=>"edit", "issue_id"=>"2", "controller"=>"timelog"}
SQL (0.000366) SELECT max("settings".updated_on) AS max_updated_on FROM "settings"
User Load (0.001245) SELECT * FROM "users" WHERE ("users"."id" = 3) AND (status = 1)
Issue Load (0.001157) SELECT * FROM "issues" WHERE ("issues"."id" = 2)
Project Load (0.000951) SELECT * FROM "projects" WHERE ("projects"."id" = 2)
EnabledModule Load (0.001991) SELECT * FROM "enabled_modules" WHERE ("enabled_modules".project_id = 2)
NoMethodError (undefined method call_hook' for #<TimelogController:0xb499caf0>):
edit'
/app/controllers/timelog_controller.rb:192:in
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:1162:in send'
perform_action_without_filters'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:1162:in
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/filters.rb:580:in call_filters'
perform_action_without_benchmark'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/filters.rb:573:in
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/benchmarking.rb:68:in perform_action_without_rescue'
measure'
/usr/lib/ruby/1.8/benchmark.rb:293:in
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/benchmarking.rb:68:in perform_action_without_rescue'
perform_action_without_caching'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/rescue.rb:201:in
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/caching/sql_cache.rb:13:in perform_action'
cache'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in
/usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/query_cache.rb:8:in cache'
perform_action'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/caching/sql_cache.rb:12:in
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:529:in send'
process_without_filters'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:529:in
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/filters.rb:569:in process_without_session_management_support'
process'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/session_management.rb:130:in
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:389:in process'
handle_request'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:149:in
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:107:in dispatch'
synchronize'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:104:in
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:104:in dispatch'
dispatch_cgi'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:120:in
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:35:in dispatch'
process'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:76:in
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:74:in synchronize'
process'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:74:in
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in process_client'
each'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in process_client'
run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in initialize'
new'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in run'
initialize'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in new'
run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:282:in run'
each'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in run'
run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:128:in
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/command.rb:212:in run'
load'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:502:in
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:502:in load'
new_constants_in'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:354:in
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:502:in load'
gem_original_require'
/usr/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/commands/servers/mongrel.rb:64
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in require'
require'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:354:in new_constants_in'
require'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in
/usr/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/commands/server.rb:39
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in gem_original_require'
require'
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in
script/server:3
Rendering /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/templates/rescues/layout.erb (internal_server_error)
@
journals
i found the problem, in IssuesController i dont get error because of mixin with IssuesHelper and inside IssuesHelper have a mixin with ApplicationHelper that include the Redmine::Hook::Helper that have the method call_hook, TimelogController has a mixin too with TimelogHelper but TimelogHelper dont have a mixin with ApplicationHelper, well instead of mixin every helper i changed the hook.rb file lib/redmine/hook.rb in the last line i add *ActionController::Base.send(:include, Redmine::Hook::Helper)* now all the controllers have the call_hook method.
--------------------------------------------------------------------------------
Good research, I knew somewhere the Redmine::Hook::Helper wasn't getting mixed in but I didn't have the time to debug it. I should be able to create a fix for this soon.
--------------------------------------------------------------------------------
@Redmine::Hook::Helper@ is now included in @ActionController::Base@ so @call_hook@ is available in all controllers. Thank you for your bug report and the research. r1979
--------------------------------------------------------------------------------
Closing this ticket since it seems to be fixed.
--------------------------------------------------------------------------------