giddie / redmine_default_assign

Redmine ticket #482:Default assignment setting -- converted to a plugin and then extended.
Other
34 stars 26 forks source link

500 and 404 error when accessing project settings #7

Closed dpanda closed 11 years ago

dpanda commented 11 years ago

After pluigin installation, I can no longer reach a project's settings page.

If I do not choose a default assignee in plugin configuration, I get a 500 error with these log messages:

Started GET "/projects/starbytes/settings" for 127.0.0.1 at 2013-06-28 11:52:39 +0200
Processing by ProjectsController#settings as HTML
  Parameters: {"id"=>"starbytes"}
  Rendered projects/_form.html.erb (41.3ms)
  Rendered projects/_edit.html.erb (42.5ms)
  Rendered common/_tabs.html.erb (48.4ms)
  Rendered projects/settings.html.erb within layouts/base (49.1ms)
Completed 500 Internal Server Error in 63ms

ActionView::Template::Error (undefined method `default_assignee_id' for #<Project:0xc62e894>):
    20: <% @project.custom_field_values.each do |value| %>
    21:   <p><%= custom_field_tag_with_label :project, value %></p>
    22: <% end %>
    23: <%= call_hook(:view_projects_form, :project => @project, :form => f) %>
    24: </div>
    25: 
    26: <% if @project.new_record? %>
  lib/redmine/views/labelled_form_builder.rb:34:in `select'
  lib/redmine/hook.rb:61:in `block (2 levels) in call_hook'
  lib/redmine/hook.rb:61:in `each'
  lib/redmine/hook.rb:61:in `block in call_hook'
  lib/redmine/hook.rb:58:in `tap'
  lib/redmine/hook.rb:58:in `call_hook'
  lib/redmine/hook.rb:151:in `call_hook'
  app/views/projects/_form.html.erb:23:in `_app_views_projects__form_html_erb___1043722183_102931190'
  app/views/projects/_edit.html.erb:2:in `block in _app_views_projects__edit_html_erb__240449558_101734930'
  app/helpers/application_helper.rb:950:in `labelled_form_for'
  app/views/projects/_edit.html.erb:1:in `_app_views_projects__edit_html_erb__240449558_101734930'
  app/views/common/_tabs.html.erb:24:in `block in _app_views_common__tabs_html_erb___146195271_95838560'
  app/views/common/_tabs.html.erb:23:in `each'
  app/views/common/_tabs.html.erb:23:in `_app_views_common__tabs_html_erb___146195271_95838560'
  app/helpers/application_helper.rb:231:in `render_tabs'
  app/views/projects/settings.html.erb:3:in `_app_views_projects_settings_html_erb___631704006_99977100'

If I choose a default assignee, I get a 404 error, althought I still see a 500 error in the logs:

Started GET "/projects/starbytes/settings" for 127.0.0.1 at 2013-06-28 11:53:45 +0200
Processing by ProjectsController#settings as HTML
  Parameters: {"id"=>"starbytes"}
  Rendered projects/_form.html.erb (41.8ms)
  Rendered projects/_edit.html.erb (43.1ms)
  Rendered common/_tabs.html.erb (49.2ms)
  Rendered projects/settings.html.erb within layouts/base (50.1ms)
Completed 500 Internal Server Error in 65ms

ActiveRecord::RecordNotFound (Couldn't find User with id=47 [WHERE `users`.`type` IN ('User', 'AnonymousUser')]):
  lib/redmine/hook.rb:61:in `block (2 levels) in call_hook'
  lib/redmine/hook.rb:61:in `each'
  lib/redmine/hook.rb:61:in `block in call_hook'
  lib/redmine/hook.rb:58:in `tap'
  lib/redmine/hook.rb:58:in `call_hook'
  lib/redmine/hook.rb:151:in `call_hook'
  app/views/projects/_form.html.erb:23:in `_app_views_projects__form_html_erb___1043722183_102931190'
  app/views/projects/_edit.html.erb:2:in `block in _app_views_projects__edit_html_erb__240449558_101734930'
  app/helpers/application_helper.rb:950:in `labelled_form_for'
  app/views/projects/_edit.html.erb:1:in `_app_views_projects__edit_html_erb__240449558_101734930'
  app/views/common/_tabs.html.erb:24:in `block in _app_views_common__tabs_html_erb___146195271_95838560'
  app/views/common/_tabs.html.erb:23:in `each'
  app/views/common/_tabs.html.erb:23:in `_app_views_common__tabs_html_erb___146195271_95838560'
  app/helpers/application_helper.rb:231:in `render_tabs'
  app/views/projects/settings.html.erb:3:in `_app_views_projects_settings_html_erb___631704006_99977100'
giddie commented 11 years ago

Have you run the plugin migrations, as described in the documentation? http://www.redmine.org/projects/redmine/wiki/Plugins

dpanda commented 11 years ago

Yes, i did, I got this output:

root@dev:/var/www/redmine/plugins/redmine_default_assign# rake redmine:plugins:migrate NAME=redmine_default_assign VERSION=0 RAILS_ENV=production
(in /mnt/data2/redmine)
Migrating redmine_default_assign (Default Assign plugin)...
giddie commented 11 years ago

This is some very odd stuff. Are you sure it's connecting to the right database? Was everything working fine before the plugin was installed?

dpanda commented 11 years ago

Everything was fine, and this is the only plugin I've installed so far.

The user I selected as default was a group, but then I also tried with a regular user and got the same error. The users belong to the project.

giddie commented 11 years ago

Do you have an admin interface such as phpPgAdmin or phpMyAdmin installed, or something similar that you can inspect your database with? That first error message about the default_assignee_id method being missing is a very strong indicator that the corresponding column is missing in the database, which would mean that for some reason the migration failed.

dpanda commented 11 years ago

You are right, the default_assignee_id column was missing, I created it manually. Thank you.

Now I can access settings page, but only if I choose a User as default assegnee; if I choose a Group, I still got the error, and a message like this:

ActiveRecord::RecordNotFound (Couldn't find User with id=48 [WHERE `users`.`type` IN ('User', 'AnonymousUser')]):

I think it should look for users also in Group, besides User and AnonymousUser (or Group user should be removed from the dropdown menu when making the selection).

giddie commented 11 years ago

You're right; that's a genuine bug. I'll get it fixed.

giddie commented 11 years ago

This should be fixed now, in the 0.4 tag. Thanks for reporting :)