jrupesh / event_notifications

Redmine event notifications : Add event notification options to the each event at the redmine project. For EX: notifications can be enabled / disabled on each document added or news added. Further the tracking can be done at the issue tracker level.
BSD 3-Clause "New" or "Revised" License
28 stars 26 forks source link

event_notifications and redmine 3.3.1 #38

Open dinya opened 6 years ago

dinya commented 6 years ago

I want to install the last master to Redmine 3.3.1.

bundle exec rake redmine:plugins:migrate RAILS_ENV="production"

raises

rake aborted!
NoMethodError: undefined method `safe_attributes' for #<Class:0x0000000636e600>
Did you mean?  cache_attributes
               scope_attributes
               cached_attributes
               scope_attributes?
               cache_attribute?
/usr/local/rvm/gems/ruby-2.3.3/gems/activerecord-4.2.7.1/lib/active_record/dynamic_matchers.rb:26:in `method_missing'
/home/redmine/redmine-3.3.1/plugins/event_notifications/lib/event_notification/patches/user_preference_patch.rb:11:in `block in included'
/home/redmine/redmine-3.3.1/plugins/event_notifications/lib/event_notification/patches/user_preference_patch.rb:9:in `class_eval'
/home/redmine/redmine-3.3.1/plugins/event_notifications/lib/event_notification/patches/user_preference_patch.rb:9:in `included'
/home/redmine/redmine-3.3.1/plugins/event_notifications/lib/event_notification/patches/user_preference_patch.rb:54:in `include'
/home/redmine/redmine-3.3.1/plugins/event_notifications/lib/event_notification/patches/user_preference_patch.rb:54:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require'
/usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `block in require'
/usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:240:in `load_dependency'
/usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require'
/home/redmine/redmine-3.3.1/plugins/event_notifications/init.rb:15:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require'
/usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `block in require'
/usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:240:in `load_dependency'
/usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require'
/home/redmine/redmine-3.3.1/lib/redmine/plugin.rb:155:in `block in load'
/home/redmine/redmine-3.3.1/lib/redmine/plugin.rb:146:in `each'
/home/redmine/redmine-3.3.1/lib/redmine/plugin.rb:146:in `load'
/home/redmine/redmine-3.3.1/config/initializers/30-redmine.rb:21:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:268:in `load'
/usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:268:in `block in load'
/usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:240:in `load_dependency'
/usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:268:in `load'
/usr/local/rvm/gems/ruby-2.3.3/gems/railties-4.2.7.1/lib/rails/engine.rb:652:in `block in load_config_initializer'
/usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-4.2.7.1/lib/active_support/notifications.rb:166:in `instrument'
/usr/local/rvm/gems/ruby-2.3.3/gems/railties-4.2.7.1/lib/rails/engine.rb:651:in `load_config_initializer'
/usr/local/rvm/gems/ruby-2.3.3/gems/railties-4.2.7.1/lib/rails/engine.rb:616:in `block (2 levels) in <class:Engine>'
/usr/local/rvm/gems/ruby-2.3.3/gems/railties-4.2.7.1/lib/rails/engine.rb:615:in `each'
/usr/local/rvm/gems/ruby-2.3.3/gems/railties-4.2.7.1/lib/rails/engine.rb:615:in `block in <class:Engine>'
/usr/local/rvm/gems/ruby-2.3.3/gems/railties-4.2.7.1/lib/rails/initializable.rb:30:in `instance_exec'
/usr/local/rvm/gems/ruby-2.3.3/gems/railties-4.2.7.1/lib/rails/initializable.rb:30:in `run'
/usr/local/rvm/gems/ruby-2.3.3/gems/railties-4.2.7.1/lib/rails/initializable.rb:55:in `block in run_initializers'
/usr/local/rvm/gems/ruby-2.3.3/gems/railties-4.2.7.1/lib/rails/initializable.rb:44:in `each'
/usr/local/rvm/gems/ruby-2.3.3/gems/railties-4.2.7.1/lib/rails/initializable.rb:44:in `tsort_each_child'
/usr/local/rvm/gems/ruby-2.3.3/gems/railties-4.2.7.1/lib/rails/initializable.rb:54:in `run_initializers'
/usr/local/rvm/gems/ruby-2.3.3/gems/railties-4.2.7.1/lib/rails/application.rb:352:in `initialize!'
/home/redmine/redmine-3.3.1/config/environment.rb:14:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require'
/usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `block in require'
/usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:240:in `load_dependency'
/usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require'
/home/redmine/redmine-3.3.1/plugins/a_common_libs/lib/tasks/a_common_libs.rake:1:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:268:in `load'
/usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:268:in `block in load'
/usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:240:in `load_dependency'
/usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:268:in `load'
/home/redmine/redmine-3.3.1/lib/tasks/redmine.rake:186:in `block in <top (required)>'
/home/redmine/redmine-3.3.1/lib/tasks/redmine.rake:186:in `each'
/home/redmine/redmine-3.3.1/lib/tasks/redmine.rake:186:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:268:in `load'
/usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:268:in `block in load'
/usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:240:in `load_dependency'
/usr/local/rvm/gems/ruby-2.3.3/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:268:in `load'
/usr/local/rvm/gems/ruby-2.3.3/gems/railties-4.2.7.1/lib/rails/engine.rb:658:in `block in run_tasks_blocks'
/usr/local/rvm/gems/ruby-2.3.3/gems/railties-4.2.7.1/lib/rails/engine.rb:658:in `each'
/usr/local/rvm/gems/ruby-2.3.3/gems/railties-4.2.7.1/lib/rails/engine.rb:658:in `run_tasks_blocks'
/usr/local/rvm/gems/ruby-2.3.3/gems/railties-4.2.7.1/lib/rails/application.rb:452:in `run_tasks_blocks'
/usr/local/rvm/gems/ruby-2.3.3/gems/railties-4.2.7.1/lib/rails/engine.rb:453:in `load_tasks'
/usr/local/rvm/gems/ruby-2.3.3/gems/railties-4.2.7.1/lib/rails/railtie.rb:194:in `public_send'
/usr/local/rvm/gems/ruby-2.3.3/gems/railties-4.2.7.1/lib/rails/railtie.rb:194:in `method_missing'
/home/redmine/redmine-3.3.1/Rakefile:7:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.3.3/gems/rake-12.0.0/exe/rake:27:in `<top (required)> '
/usr/local/rvm/gems/ruby-2.3.3/bin/ruby_executable_hooks:15:in `eval'
/usr/local/rvm/gems/ruby-2.3.3/bin/ruby_executable_hooks:15:in `<main>'
(See full trace by running task with --trace)

Which commit of plugin from git should I use? Or update to Redmine 3.4 is better way?

My current env:

Environment:
  Redmine version                3.3.1.stable
  Ruby version                   2.3.3-p222 (2016-11-21) [x86_64-linux]
  Rails version                  4.2.7.1
  Environment                    production
  Database adapter               Mysql2
rchady commented 6 years ago

I ran in to the exact same issue on 3.3.3. You find any solution for this?

rchady commented 6 years ago

Went digging in to this and found my own solution. It seems UserPreference doesn't include Redmine::SafeAttributes. I added an include Redmine::SafeAttributes in the class_eval block for the user_preference_patch file and it seems to be working as expected now.

dinya commented 6 years ago

@rchady

I'm not so good in Ruby. Could you send the diff?

jrupesh commented 6 years ago

Hi, Probably it is a good idea to do an update to your redmine instance. Thanks.