dkuk / a_common_libs

Plugin for Redmine which enable of inclusion common libraries (bootstrap, select2, highcharts, etc.)
7 stars 6 forks source link

Undefined method `favourite_project_id' #3

Open heyrex opened 9 years ago

heyrex commented 9 years ago

After installing a_common_libs the /my/account page cannot be accessed

Error message: Undefined method `favourite_project_id' for #UserPreference:0x00000008923cb0

Environment: Redmine version 2.6.3.stable Ruby version 1.9.3-p0 (2011-10-30) [x86_64-linux] Rails version 3.2.21 Environment production Database adapter Mysql2 SCM: Git 1.7.9.5 Filesystem
Redmine plugins: a_common_libs 1.1.3 extra_queries 0.0.1 redmine_contacts 3.4.5 redmine_contacts_helpdesk 2.4.0 redmine_my_page_queries 2.1.6 usability 1.0.0

Error log /var/lib/gems/1.9.1/gems/activemodel-3.2.21/lib/active_model/attribute_methods.rb:407:in method_missing' /var/lib/gems/1.9.1/gems/activerecord-3.2.21/lib/active_record/attribute_methods.rb:149:inmethod_missing' /usr/share/redmine/plugins/a_common_libs/lib/a_common_libs/user_patch.rb:13:in favourite_project' /usr/share/redmine/plugins/a_common_libs/app/views/hooks/a_common_libs/_favourite_project.html.erb:4:inblock in _plugins_a_common_libs_app_views_hooks_a_common_libsfavourite_project_html_erb__1391240625229227395_71289700' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_view/helpers/capture_helper.rb:40:in block in capture' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_view/helpers/capture_helper.rb:187:inwith_output_buffer' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_view/helpers/capture_helper.rb:40:in capture' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_view/helpers/form_helper.rb:605:infields_for' /usr/share/redmine/app/helpers/application_helper.rb:1063:in labelled_fields_for' /usr/share/redmine/plugins/a_common_libs/app/views/hooks/a_common_libs/_favourite_project.html.erb:1:in_plugins_a_common_libs_app_views_hooks_a_common_libsfavourite_project_html_erb1391240625229227395_71289700' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_view/template.rb:145:in block in render' /var/lib/gems/1.9.1/gems/activesupport-3.2.21/lib/active_support/notifications.rb:125:ininstrument' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_view/template.rb:143:in render' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_view/renderer/partial_renderer.rb:265:inrender_partial' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_view/renderer/partial_renderer.rb:238:in block in render' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_view/renderer/abstract_renderer.rb:38:inblock in instrument' /var/lib/gems/1.9.1/gems/activesupport-3.2.21/lib/active_support/notifications.rb:123:in block in instrument' /var/lib/gems/1.9.1/gems/activesupport-3.2.21/lib/active_support/notifications/instrumenter.rb:20:ininstrument' /var/lib/gems/1.9.1/gems/activesupport-3.2.21/lib/active_support/notifications.rb:123:in instrument' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_view/renderer/abstract_renderer.rb:38:ininstrument' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_view/renderer/partial_renderer.rb:237:in render' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_view/renderer/renderer.rb:41:inrender_partial' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_view/renderer/renderer.rb:15:in render' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_view/helpers/rendering_helper.rb:24:inrender' /usr/share/redmine/lib/redmine/hook.rb:111:in block in render_on' /usr/share/redmine/lib/redmine/hook.rb:61:inblock (2 levels) in call_hook' /usr/share/redmine/lib/redmine/hook.rb:61:in each' /usr/share/redmine/lib/redmine/hook.rb:61:inblock in call_hook' /usr/share/redmine/lib/redmine/hook.rb:58:in tap' /usr/share/redmine/lib/redmine/hook.rb:58:incall_hook' /usr/share/redmine/lib/redmine/hook.rb:158:in call_hook' /usr/share/redmine/app/views/my/account.html.erb:29:inblock in _app_views_my_account_html_erb1224645187859606954_69776420' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_view/helpers/capture_helper.rb:40:in block in capture' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_view/helpers/capture_helper.rb:187:inwith_output_buffer' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_view/helpers/capture_helper.rb:40:in capture' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_view/helpers/form_helper.rb:378:inform_for' /usr/share/redmine/app/helpers/application_helper.rb:1056:in labelled_form_for' /usr/share/redmine/app/views/my/account.html.erb:9:in_app_views_my_account_html_erb1224645187859606954_69776420' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_view/template.rb:145:in block in render' /var/lib/gems/1.9.1/gems/activesupport-3.2.21/lib/active_support/notifications.rb:125:ininstrument' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_view/template.rb:143:in render' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_view/renderer/template_renderer.rb:47:inblock (2 levels) in render_template' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_view/renderer/abstract_renderer.rb:38:in block in instrument' /var/lib/gems/1.9.1/gems/activesupport-3.2.21/lib/active_support/notifications.rb:123:inblock in instrument' /var/lib/gems/1.9.1/gems/activesupport-3.2.21/lib/active_support/notifications/instrumenter.rb:20:in instrument' /var/lib/gems/1.9.1/gems/activesupport-3.2.21/lib/active_support/notifications.rb:123:ininstrument' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_view/renderer/abstract_renderer.rb:38:in instrument' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_view/renderer/template_renderer.rb:46:inblock in render_template' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_view/renderer/template_renderer.rb:54:in render_with_layout' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_view/renderer/template_renderer.rb:45:inrender_template' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_view/renderer/template_renderer.rb:18:in render' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_view/renderer/renderer.rb:36:inrender_template' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_view/renderer/renderer.rb:17:in render' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/abstract_controller/rendering.rb:110:in_render_template' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_controller/metal/streaming.rb:225:in _render_template' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/abstract_controller/rendering.rb:103:inrender_to_body' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_controller/metal/renderers.rb:28:in render_to_body' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_controller/metal/compatibility.rb:50:inrender_to_body' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/abstract_controller/rendering.rb:88:in render' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_controller/metal/rendering.rb:16:inrender' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_controller/metal/instrumentation.rb:40:in block (2 levels) in render' /var/lib/gems/1.9.1/gems/activesupport-3.2.21/lib/active_support/core_ext/benchmark.rb:5:inblock in ms' /usr/lib/ruby/1.9.1/benchmark.rb:295:in realtime' /var/lib/gems/1.9.1/gems/activesupport-3.2.21/lib/active_support/core_ext/benchmark.rb:5:inms' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_controller/metal/instrumentation.rb:40:in block in render' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_controller/metal/instrumentation.rb:83:incleanup_view_runtime' /var/lib/gems/1.9.1/gems/activerecord-3.2.21/lib/active_record/railties/controller_runtime.rb:24:in cleanup_view_runtime' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_controller/metal/instrumentation.rb:39:inrender' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_controller/metal/implicit_render.rb:10:in default_render' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_controller/metal/implicit_render.rb:5:insend_action' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/abstract_controller/base.rb:167:in process_action' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_controller/metal/rendering.rb:10:inprocess_action' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/abstract_controller/callbacks.rb:18:in block in process_action' /var/lib/gems/1.9.1/gems/activesupport-3.2.21/lib/active_support/callbacks.rb:502:in_run1544964049843967080process_action1829087673449486467callbacks' /var/lib/gems/1.9.1/gems/activesupport-3.2.21/lib/active_support/callbacks.rb:405:in `run_callback' /var/lib/gems/1.9.1/gems/activesupport-3.2.21/lib/active_support/callbacks.rb:385:in_run_process_action_callbacks' /var/lib/gems/1.9.1/gems/activesupport-3.2.21/lib/active_support/callbacks.rb:81:inrun_callbacks' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/abstract_controller/callbacks.rb:17:inprocess_action' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_controller/metal/rescue.rb:29:inprocess_action' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_controller/metal/instrumentation.rb:30:inblock in process_action' /var/lib/gems/1.9.1/gems/activesupport-3.2.21/lib/active_support/notifications.rb:123:inblock in instrument' /var/lib/gems/1.9.1/gems/activesupport-3.2.21/lib/active_support/notifications/instrumenter.rb:20:ininstrument' /var/lib/gems/1.9.1/gems/activesupport-3.2.21/lib/active_support/notifications.rb:123:ininstrument' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_controller/metal/instrumentation.rb:29:inprocess_action' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_controller/metal/params_wrapper.rb:207:inprocess_action' /var/lib/gems/1.9.1/gems/activerecord-3.2.21/lib/active_record/railties/controller_runtime.rb:18:inprocess_action' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/abstract_controller/base.rb:121:inprocess' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/abstract_controller/rendering.rb:45:inprocess' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_controller/metal.rb:203:indispatch' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_controller/metal/rack_delegation.rb:14:indispatch' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_controller/metal.rb:246:inblock in action' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_dispatch/routing/route_set.rb:73:incall' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_dispatch/routing/route_set.rb:73:indispatch' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_dispatch/routing/route_set.rb:36:incall' /var/lib/gems/1.9.1/gems/journey-1.0.4/lib/journey/router.rb:68:inblock in call' /var/lib/gems/1.9.1/gems/journey-1.0.4/lib/journey/router.rb:56:ineach' /var/lib/gems/1.9.1/gems/journey-1.0.4/lib/journey/router.rb:56:incall' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_dispatch/routing/route_set.rb:608:incall' /var/lib/gems/1.9.1/gems/rack-openid-1.4.2/lib/rack/openid.rb:98:incall' /var/lib/gems/1.9.1/gems/request_store-1.0.5/lib/request_store/middleware.rb:9:incall' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_dispatch/middleware/best_standards_support.rb:17:incall' /var/lib/gems/1.9.1/gems/rack-1.4.5/lib/rack/etag.rb:23:incall' /var/lib/gems/1.9.1/gems/rack-1.4.5/lib/rack/conditionalget.rb:25:incall' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_dispatch/middleware/head.rb:14:incall' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_dispatch/middleware/params_parser.rb:21:incall' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_dispatch/middleware/flash.rb:242:incall' /var/lib/gems/1.9.1/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:210:incontext' /var/lib/gems/1.9.1/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:205:incall' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_dispatch/middleware/cookies.rb:341:incall' /var/lib/gems/1.9.1/gems/activerecord-3.2.21/lib/active_record/query_cache.rb:64:incall' /var/lib/gems/1.9.1/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract/connection_pool.rb:479:incall' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_dispatch/middleware/callbacks.rb:28:inblock in call' /var/lib/gems/1.9.1/gems/activesupport-3.2.21/lib/active_support/callbacks.rb:405:in_run4570882839644634479call1422444520153113341callbacks' /var/lib/gems/1.9.1/gems/activesupport-3.2.21/lib/active_support/callbacks.rb:405:in__run_callback' /var/lib/gems/1.9.1/gems/activesupport-3.2.21/lib/active_support/callbacks.rb:385:in_run_call_callbacks' /var/lib/gems/1.9.1/gems/activesupport-3.2.21/lib/active_support/callbacks.rb:81:inrun_callbacks' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_dispatch/middleware/callbacks.rb:27:incall' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_dispatch/middleware/remote_ip.rb:31:incall' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_dispatch/middleware/debug_exceptions.rb:16:incall' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_dispatch/middleware/show_exceptions.rb:56:incall' /var/lib/gems/1.9.1/gems/railties-3.2.21/lib/rails/rack/logger.rb:32:incall_app' /var/lib/gems/1.9.1/gems/railties-3.2.21/lib/rails/rack/logger.rb:16:inblock in call' /var/lib/gems/1.9.1/gems/activesupport-3.2.21/lib/active_support/tagged_logging.rb:22:intagged' /var/lib/gems/1.9.1/gems/railties-3.2.21/lib/rails/rack/logger.rb:16:incall' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_dispatch/middleware/request_id.rb:22:incall' /var/lib/gems/1.9.1/gems/rack-1.4.5/lib/rack/methodoverride.rb:21:incall' /var/lib/gems/1.9.1/gems/rack-1.4.5/lib/rack/runtime.rb:17:incall' /var/lib/gems/1.9.1/gems/activesupport-3.2.21/lib/active_support/cache/strategy/local_cache.rb:72:incall' /var/lib/gems/1.9.1/gems/rack-1.4.5/lib/rack/lock.rb:15:incall' /var/lib/gems/1.9.1/gems/actionpack-3.2.21/lib/action_dispatch/middleware/static.rb:83:incall' /var/lib/gems/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:inforward' /var/lib/gems/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:245:infetch' /var/lib/gems/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:185:inlookup' /var/lib/gems/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:66:incall!' /var/lib/gems/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:incall' /var/lib/gems/1.9.1/gems/railties-3.2.21/lib/rails/engine.rb:484:incall' /var/lib/gems/1.9.1/gems/railties-3.2.21/lib/rails/application.rb:231:incall' /var/lib/gems/1.9.1/gems/railties-3.2.21/lib/rails/railtie/configurable.rb:30:inmethod_missing' /var/lib/gems/1.9.1/gems/passenger-5.0.5/lib/phusion_passenger/rack/thread_handler_extension.rb:85:inprocess_request' /var/lib/gems/1.9.1/gems/passenger-5.0.5/lib/phusion_passenger/request_handler/thread_handler.rb:149:inaccept_and_process_next_request' /var/lib/gems/1.9.1/gems/passenger-5.0.5/lib/phusion_passenger/request_handler/thread_handler.rb:110:inmain_loop' /var/lib/gems/1.9.1/gems/passenger-5.0.5/lib/phusion_passenger/request_handler.rb:414:inblock (3 levels) in start_threads' /var/lib/gems/1.9.1/gems/passenger-5.0.5/lib/phusion_passenger/utils.rb:111:inblock in create_thread_and_abort_on_exception'

dkuk commented 9 years ago

Repo is moved to https://dkuk@bitbucket.org/dkuk/a_common_libs.git

p42n3 commented 9 years ago

Hi!

I've got the same error - and at Bitbucket-Repo I can't find an Issue Tracker... (Maybe you have it deactivated or set to private?)

plz help... (my Bitbucket user name is panne, if you wish to contact me to get more informations about this bug...)

everkhoturov commented 9 years ago

I have the same problem.

1549 Completed 500 Internal Server Error in 23.2ms 1550 1551 ActionView::Template::Error (undefined method `favourite_project_id' for #UserPreference:0xc2ab3e8): 1552 1: <%= labelled_fields_for :pref, @user.pref do |pref_fields| %> 1553 2:

1554 3: <%= pref_fields.select( :favourite_project_id, 1555 4: ''.html_safe + project_tree_options_for_select(Project.all, selected: @user.favourite_project)) %> 1556 5:

1557 6: <% end %>

Ruby 1.9.3

heyrex commented 9 years ago

I fixed this issue by removing the plugins I downloaded from GitHub and I downloading them from BitBucket.

Including:

p42n3 commented 9 years ago

I just tried @heyrex hint and switched a_common_libs and also usability_plugin from GitHub to BitBucket, doesn't help. (Versions have been the same already.)

@dkuk : unfortunately still can't find the bugtracker activated on BitBucket... Is this with intent?

heyrex commented 9 years ago

When changing source from git to bitbucket I also reversed the database migration before deleting the plugins and then reapplied it after downloading them from the new location.

Eg: $> cd redmine/plugins/ $> rake redmine:plugins:migrate NAME=a_common_libs VERSION=0 RAILS_ENV=production $> rake redmine:plugins:migrate NAME=usability VERSION=0 RAILS_ENV=production $> rm -R a_common_libs $> rm -R usability $> git clone https://bitbucket.org/dkuk/a_common_libs.git $> unzip usability.tar.gz (name & command may vary on your system) $> cd usability $> bundle install $> rake redmine:plugins:migrate RAILS_ENV=production $> service apache2 restart

Maybe that will help?

p42n3 commented 9 years ago

Yes, great, now it works! Thanks, @heyrex :)

p42n3 commented 9 years ago

Update: not everything is working =/

Pages /my/account and /user/$id/edit are functional, but on add user page ( /users/new ) I still get the same error, "undefined method `favourite_project_id' for #UserPreference:0x000000075d82c8".

So, (of course) I'm still unable to add new users...

(Stacktrace)

BRUTEF0RCE commented 9 years ago

Same problem here

dkuk commented 9 years ago

Repository was moved to https://bitbucket.org/dkuk/a_common_libs.git Also all other rm plugins repos moved too. Look for actual plugins versions on bitbucket. It is important of usage of fresh usability with actual a_common_libs version. Check is issue reproduces on latest version?

ZaLiTHkA commented 9 years ago

I'm getting this error with the "global roles" 2.0.0 (downloaded from the RM+ website) and "a common libs" 1.1.3 (downloaded from BitBucket). Both of them were downloaded just this morning, so I highly doubt I have old code.

I just had a look at the "global roles" repo over on BitBucket, and the init.rb file in tag v1.1 shows a version of 0.0.1, whereas the same file from the website download link shows a version of 2.0.0.

@dkuk, care to shed some light on what the latest version really is and where we can download it?

[edit] For what it's worth, I just discovered this issue doesn't crop up running Redmine 2.6.6 under Linux (Bitnami VM), but it does with my Redmine 2.5.2 installation in Windows (Bitnami Stack).

karelwar commented 9 years ago

Heyrex's solution is obviously the right one. You need to uninstall old one first: 1) rake redmine:plugins:migrate NAME=a_common_libs VERSION=0 RAILS_ENV=production 2) delete a_common_libs from plugins folder 3) copy to that location new version (from bitbucket) 4) rake redmine:plugins RAILS_ENV=production and after that restart redmine

@heyrex: Thanks a lot, it save my day :+1:

vagkavan commented 8 years ago

Same issue in two systems with clean install of the latest version (1.1.8) on Friday, 13 November 2015 based on instructions: http://rmplus.pro/en/redmine/plugins/issue_tabs. System 1 configuration: http://pastebin.com/dF2avWxx System 2 configuration: http://pastebin.com/afB5d1Rw production.log tail: http://pastebin.com/dx3GSTV8

Fixed also after running: rake redmine:plugins:migrate RAILS_ENV=production and restarting redmine

asilverstein commented 8 years ago

Also used solution by @heyrex, thanks again