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

Relation#all is deprecated => ActionView::Template::Error (undefined method `order' for #<Array:...>) #21

Closed tssajo closed 8 years ago

tssajo commented 8 years ago

Hello,

We get the following error when we try to access the /settings/plugin/event_notifications page from our Redmine installation:

Started GET "/settings/plugin/event_notifications" for 85.xx.xx.xx at 2016-03-23 09:27:56 +0100
Processing by SettingsController#plugin as HTML
  Parameters: {"id"=>"event_notifications"}
  Current user: tssajo (id=4)
DEPRECATION WARNING: Relation#all is deprecated. If you want to eager-load a relation, you can call #load (e.g. `Post.where(published: true).load`). If you want to get an array of records from a relation, you can call #to_a (e.g. `Post.w
here(published: true).to_a`). (called from _plugins_event_notifications_app_views_settings__event_notifications_settings_html_erb__4472448882943073870_70052018044040 at /var/www/vhosts/redmine.ourdomain.com/plugins/event_notifications
/app/views/settings/_event_notifications_settings.html.erb:45)
  Rendered plugins/event_notifications/app/views/settings/_event_notifications_settings.html.erb (60.4ms)
  Rendered settings/plugin.html.erb within layouts/admin (61.5ms)
Completed 500 Internal Server Error in 68ms (ActiveRecord: 1.1ms)

ActionView::Template::Error (undefined method `order' for #<Array:0x007f6c86cfe488>):
    42:
    43:
    44:         <h4><%= l(:enable_notification_for_project_issue_categories)%></h4>
    45:         <% Project.includes(:issue_categories).all.order('lft ASC').each do |project|
    46:                 if project.issue_categories.any? %>
    47:                         <p>
    48:                           <label><%= project.name %></label>
  app/views/settings/plugin.html.erb:6:in `block in _app_views_settings_plugin_html_erb__2642719359157881884_70052017873400'
  app/views/settings/plugin.html.erb:4:in `_app_views_settings_plugin_html_erb__2642719359157881884_70052017873400'
  lib/redmine/sudo_mode.rb:63:in `sudo_mode'

Our environment (we use CentOS 6.7) :

Environment:
  Redmine version                3.2.0.stable
  Ruby version                   2.1.2-p95 (2014-05-08) [x86_64-linux]
  Rails version                  4.2.5
  Environment                    production
  Database adapter               Mysql2
SCM:
  Subversion                     1.6.11
  Git                            1.7.1
  Filesystem                     
Redmine plugins:
  clipboard_image_paste          1.10
  event_notifications            3.2.0
  redmine_agile                  1.3.8
  redmine_ckeditor               1.1.3
  redmine_plugin_views_revisions 0.0.1
  redmine_screenshot_paste       2.1.0
  redmine_wiki_extensions        0.7.0
  redmine_xls_export             0.2.1.t9
  scrum                          0.13.0
  time_logger                    0.5.3

Can you please help us fix this? Thanks!!

tssajo commented 8 years ago

Thanks!