mbasset / project_overview

Adds a new project overview page to redmine 2+.
MIT License
13 stars 9 forks source link

last_user_event raises error if current user hasn't any events #7

Closed CodeInsider closed 11 years ago

CodeInsider commented 11 years ago

Log: ActionView::Template::Error (undefined method created_on' for #<WikiContent::Version:0x2ae7b3a97cf0>): 1: <% last_event = last_user_event(team_member) %>^M 2: <% if last_event && (last_event.respond_to?(:committed_on) ? last_event.committed_on : last_event.created_on 3: ><div class="po_team_member">^M 4: ><------><div class="upper_left"><%= avatar team_member, :size => "50" %></div>^M 5: ><------><div class="upper_right"><%= link_to team_member.name, user_path(team_member), :class => "name", "d app/views/common/_tabs.html.erb:24:in_app_views_commontabs_html_erb251605230_23587323690380' app/views/common/_tabs.html.erb:23:in each' app/views/common/_tabs.html.erb:23:in_app_views_commontabs_html_erb251605230_23587323690380' app/helpers/application_helper.rb:271:in `render_tabs'

Error occured in: app/view/_team_member.html.erb

Function: def last_user_event(user) Redmine::Activity::Fetcher.new(User.current, :author => user).events(nil, nil, :limit => 1).first end

CodeInsider commented 11 years ago

This error always occur after a restart. It could be resolved by adding some Ticket or set some comment.

mbasset commented 11 years ago

Try using the stable branch. I will looks into a proper fix.

mbasset commented 11 years ago

See if that works for you.

CodeInsider commented 11 years ago

Hi,

sorry for the late reply. No it doesn't seem to work with the current trunk.

Log from testserver:

ActionView::Template::Error (undefined local variable or method project_overview_tabs' for #<#<Class:0x2b5344cb2588>:0x2b53449f3090>): 2: 3: <h2><%=l(:label_project_overview)%></h2> 4: 5: <%= render_tabs project_overview_tabs %> plugins/project_overview/app/views/overview/index.html.erb:5:in_plugins_project_overview_app_views_overview_index_html_erb1131668864_23818318198420' actionpack (3.2.12) lib/action_view/template.rb:145:in send' actionpack (3.2.12) lib/action_view/template.rb:145:inrender' activesupport (3.2.12) lib/active_support/notifications.rb:125:in instrument' actionpack (3.2.12) lib/action_view/template.rb:143:inrender' actionpack (3.2.12) lib/action_view/renderer/template_renderer.rb:47:in render_template' actionpack (3.2.12) lib/action_view/renderer/abstract_renderer.rb:38:ininstrument' activesupport (3.2.12) lib/active_support/notifications.rb:123:in instrument' activesupport (3.2.12) lib/active_support/notifications/instrumenter.rb:20:ininstrument' activesupport (3.2.12) lib/active_support/notifications.rb:123:in instrument' actionpack (3.2.12) lib/action_view/renderer/abstract_renderer.rb:38:ininstrument' actionpack (3.2.12) lib/action_view/renderer/template_renderer.rb:46:in render_template' actionpack (3.2.12) lib/action_view/renderer/template_renderer.rb:54:inrender_with_layout' actionpack (3.2.12) lib/action_view/renderer/template_renderer.rb:45:in render_template' actionpack (3.2.12) lib/action_view/renderer/template_renderer.rb:18:inrender' actionpack (3.2.12) lib/action_view/renderer/renderer.rb:36:in render_template' actionpack (3.2.12) lib/action_view/renderer/renderer.rb:17:inrender' actionpack (3.2.12) lib/abstract_controller/rendering.rb:110:in _render_template' actionpack (3.2.12) lib/action_controller/metal/streaming.rb:225:in_render_template' actionpack (3.2.12) lib/abstract_controller/rendering.rb:103:in render_to_body' actionpack (3.2.12) lib/action_controller/metal/renderers.rb:28:inrender_to_body' actionpack (3.2.12) lib/action_controller/metal/compatibility.rb:50:in render_to_body' actionpack (3.2.12) lib/abstract_controller/rendering.rb:88:inrender' actionpack (3.2.12) lib/action_controller/metal/rendering.rb:16:in render' actionpack (3.2.12) lib/action_controller/metal/instrumentation.rb:40:inrender' activesupport (3.2.12) lib/active_support/core_ext/benchmark.rb:5:in ms' /usr/lib/ruby/1.8/benchmark.rb:308:inrealtime' activesupport (3.2.12) lib/active_support/core_ext/benchmark.rb:5:in ms' actionpack (3.2.12) lib/action_controller/metal/instrumentation.rb:40:inrender' actionpack (3.2.12) lib/action_controller/metal/instrumentation.rb:83:in cleanup_view_runtime' activerecord (3.2.12) lib/active_record/railties/controller_runtime.rb:24:incleanup_view_runtime' actionpack (3.2.12) lib/action_controller/metal/instrumentation.rb:39:in render' actionpack (3.2.12) lib/action_controller/metal/implicit_render.rb:10:indefault_render' actionpack (3.2.12) lib/action_controller/metal/implicit_render.rb:5:in send_action' actionpack (3.2.12) lib/abstract_controller/base.rb:167:inprocess_action' actionpack (3.2.12) lib/action_controller/metal/rendering.rb:10:in process_action' actionpack (3.2.12) lib/abstract_controller/callbacks.rb:18:inprocess_action' activesupport (3.2.12) lib/active_support/callbacks.rb:458:in `_run214750623process_action1128922982callbacks' activesupport (3.2.12) lib/active_support/callbacks.rb:405:insend' activesupport (3.2.12) lib/active_support/callbacks.rb:405:inrun_callback' activesupport (3.2.12) lib/active_support/callbacks.rb:385:in_run_process_action_callbacks' activesupport (3.2.12) lib/active_support/callbacks.rb:81:insend' activesupport (3.2.12) lib/active_support/callbacks.rb:81:inrun_callbacks' actionpack (3.2.12) lib/abstract_controller/callbacks.rb:17:inprocess_action' actionpack (3.2.12) lib/action_controller/metal/rescue.rb:29:inprocess_action' actionpack (3.2.12) lib/action_controller/metal/instrumentation.rb:30:inprocess_action' activesupport (3.2.12) lib/active_support/notifications.rb:123:ininstrument' activesupport (3.2.12) lib/active_support/notifications/instrumenter.rb:20:ininstrument' activesupport (3.2.12) lib/active_support/notifications.rb:123:ininstrument' actionpack (3.2.12) lib/action_controller/metal/instrumentation.rb:29:inprocess_action' actionpack (3.2.12) lib/action_controller/metal/params_wrapper.rb:207:inprocess_action' activerecord (3.2.12) lib/active_record/railties/controller_runtime.rb:18:inprocess_action' actionpack (3.2.12) lib/abstract_controller/base.rb:121:inprocess' actionpack (3.2.12) lib/abstract_controller/rendering.rb:45:inprocess' actionpack (3.2.12) lib/action_controller/metal.rb:203:indispatch' actionpack (3.2.12) lib/action_controller/metal/rack_delegation.rb:14:indispatch' actionpack (3.2.12) lib/action_controller/metal.rb:246 actionpack (3.2.12) lib/action_dispatch/routing/route_set.rb:73:incall' actionpack (3.2.12) lib/action_dispatch/routing/route_set.rb:73:indispatch' actionpack (3.2.12) lib/action_dispatch/routing/route_set.rb:36:incall' journey (1.0.4) lib/journey/router.rb:68:incall' journey (1.0.4) lib/journey/router.rb:56:ineach' journey (1.0.4) lib/journey/router.rb:56:incall' actionpack (3.2.12) lib/action_dispatch/routing/route_set.rb:601:incall' rack-openid (1.3.1) lib/rack/openid.rb:98:incall' actionpack (3.2.12) lib/action_dispatch/middleware/best_standards_support.rb:17:incall' rack (1.4.5) lib/rack/etag.rb:23:incall' rack (1.4.5) lib/rack/conditionalget.rb:25:incall' actionpack (3.2.12) lib/action_dispatch/middleware/head.rb:14:incall' actionpack (3.2.12) lib/action_dispatch/middleware/params_parser.rb:21:incall' actionpack (3.2.12) lib/action_dispatch/middleware/flash.rb:242:incall' rack (1.4.5) lib/rack/session/abstract/id.rb:210:incontext' rack (1.4.5) lib/rack/session/abstract/id.rb:205:incall' actionpack (3.2.12) lib/action_dispatch/middleware/cookies.rb:341:incall' activerecord (3.2.12) lib/active_record/query_cache.rb:64:incall' activerecord (3.2.12) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:incall' actionpack (3.2.12) lib/action_dispatch/middleware/callbacks.rb:28:incall' activesupport (3.2.12) lib/active_support/callbacks.rb:405:in_run__2030107461__call__4__callbacks' activesupport (3.2.12) lib/active_support/callbacks.rb:405:insend' activesupport (3.2.12) lib/active_support/callbacks.rb:405:in__run_callback' activesupport (3.2.12) lib/active_support/callbacks.rb:385:in_run_call_callbacks' activesupport (3.2.12) lib/active_support/callbacks.rb:81:insend' activesupport (3.2.12) lib/active_support/callbacks.rb:81:inrun_callbacks' actionpack (3.2.12) lib/action_dispatch/middleware/callbacks.rb:27:incall' actionpack (3.2.12) lib/action_dispatch/middleware/remote_ip.rb:31:incall' actionpack (3.2.12) lib/action_dispatch/middleware/debug_exceptions.rb:16:incall' actionpack (3.2.12) lib/action_dispatch/middleware/show_exceptions.rb:56:incall' railties (3.2.12) lib/rails/rack/logger.rb:32:incall_app' railties (3.2.12) lib/rails/rack/logger.rb:18:incall' actionpack (3.2.12) lib/action_dispatch/middleware/request_id.rb:22:incall' rack (1.4.5) lib/rack/methodoverride.rb:21:incall' rack (1.4.5) lib/rack/runtime.rb:17:incall' activesupport (3.2.12) lib/active_support/cache/strategy/local_cache.rb:72:incall' rack (1.4.5) lib/rack/lock.rb:15:incall' actionpack (3.2.12) lib/action_dispatch/middleware/static.rb:62:incall' rack-cache (1.2) lib/rack/cache/context.rb:136:inforward' rack-cache (1.2) lib/rack/cache/context.rb:245:infetch' rack-cache (1.2) lib/rack/cache/context.rb:185:inlookup' rack-cache (1.2) lib/rack/cache/context.rb:66:incall!' rack-cache (1.2) lib/rack/cache/context.rb:51:incall' railties (3.2.12) lib/rails/engine.rb:479:incall' railties (3.2.12) lib/rails/application.rb:223:incall' railties (3.2.12) lib/rails/railtie/configurable.rb:30:insend' railties (3.2.12) lib/rails/railtie/configurable.rb:30:inmethod_missing' /usr/lib/ruby/1.8/phusion_passenger/rack/request_handler.rb:95:inprocess_request' /usr/lib/ruby/1.8/phusion_passenger/abstract_request_handler.rb:207:inmain_loop' /usr/lib/ruby/1.8/phusion_passenger/rack/application_spawner.rb:118:inrun' /usr/lib/ruby/1.8/phusion_passenger/rack/application_spawner.rb:69:inspawn_application' /usr/lib/ruby/1.8/phusion_passenger/utils.rb:184:insafe_fork' /usr/lib/ruby/1.8/phusion_passenger/rack/application_spawner.rb:62:inspawn_application' /usr/lib/ruby/1.8/phusion_passenger/rack/application_spawner.rb:45:inspawn_application' /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:159:inspawn_application' /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:287:inhandle_spawn_application' /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in__send__' /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:inmain_loop' /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:196:in`start_synchronously' /usr/lib/phusion_passenger/passenger-spawn-server:61

Best regards, Daniel

mbasset commented 11 years ago

Is is possible to get the exact error that is occurring. I can't tell from that generic one. You may need to change redmine code in application_controller to not intercept errors to allow it to display the actual problem.

CodeInsider commented 11 years ago

Hi there,

the commit seems to fix this bug on 2.2.x and on current trunk (2.3-devel).

Thanks for this!

Best regards, Daniel