Project

General

Profile

Actions

Defect #26637

closed

ActionView::Template::Error (undefined method `remote' for #<Hash:0x007f9aede03320>)

Added by Martin Blom over 7 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Invalid
Affected version:

Description

Patch #24787 seems to have introduced the following error that I get when I upgraded from 3.3.0 to 3.4.2.

Processing by IssuesController#index as HTML
  Parameters: {"project_id"=>"term"}
  Current user: mb (id=27)
  Rendered queries/_filters.html.erb (14.1ms)
  Rendered queries/_query_form.html.erb (20.7ms)
  Rendered issues/index.html.erb within layouts/base (33.4ms)
Completed 500 Internal Server Error in 285ms (ActiveRecord: 32.3ms)

ActionView::Template::Error (undefined method `remote' for #<Hash:0x007f9aede03320>):
    1: <%= javascript_tag do %>
    2: var operatorLabels = <%= raw_json Query.operators_labels %>;
    3: var operatorByType = <%= raw_json Query.operators_by_filter_type %>;
    4: var availableFilters = <%= raw_json query.available_filters_as_json %>;
    5: var labelDayPlural = <%= raw_json l(:label_day_plural) %>;
    6: 
    7: var filtersUrl = <%= raw_json queries_filter_path(:project_id => @query.project.try(:id), :type => @query.type) %>;
  app/models/query.rb:464:in `block in available_filters_as_json'
  app/models/query.rb:462:in `each'
  app/models/query.rb:462:in `available_filters_as_json'
  app/views/queries/_filters.html.erb:4:in `block in _app_views_queries__filters_html_erb___1036324529149116392_40939120'
  app/views/queries/_filters.html.erb:1:in `_app_views_queries__filters_html_erb___1036324529149116392_40939120'
  app/views/queries/_query_form.html.erb:10:in `_app_views_queries__query_form_html_erb___3000346872455193333_41555900'
  app/views/issues/index.html.erb:11:in `block in _app_views_issues_index_html_erb__2853989323921202783_43093980'
  app/views/issues/index.html.erb:10:in `_app_views_issues_index_html_erb__2853989323921202783_43093980'
  app/controllers/issues_controller.rb:51:in `block (2 levels) in index'
  app/controllers/issues_controller.rb:46:in `index'
  lib/redmine/sudo_mode.rb:63:in `sudo_mode'

I am aware of #26567 and I do have the Agile Plugin installed, but the stack trace seems to indicates that the plugin is not responsible...?

I hacked around the error like this:

diff --git a/app/models/query.rb b/app/models/query.rb
index c8c8986..95d43f5 100644
--- a/app/models/query.rb
+++ b/app/models/query.rb
@@ -461,9 +461,9 @@ class Query < ActiveRecord::Base
     json = {}
     available_filters.each do |field, filter|
       options = {:type => filter[:type], :name => filter[:name]}
-      options[:remote] = true if filter.remote
+      options[:remote] = true if filter.respond_to?('remote') && filter.remote

-      if has_filter?(field) || !filter.remote
+      if has_filter?(field) || !filter.respond_to?('remote') || !filter.remote
         options[:values] = filter.values
         if options[:values] && values_for(field)
           missing = Array(values_for(field)).select(&:present?) - options[:values].map(&:last)

I'm not a Ruby coder so I'm not sure why the remote method is missing, or if the logic is correct when the method is missing, though.

My environment:


Environment:
  Redmine version                3.4.2.stable
  Ruby version                   2.2.1-p85 (2015-02-26) [x86_64-linux]
  Rails version                  4.2.8
  Environment                    production
  Database adapter               Mysql2
SCM:
  Git                            1.7.1
  Filesystem                     
Redmine plugins:
  bestest_timer                  1.1.2
  redmine_agile                  1.4.4
  redmine_checklists             3.1.3
  redmine_editor_preview_tab     0.1.5
  redmine_issue_templates        0.1.6
  redmine_ldap_sync              2.0.4.gab2ba815ed-dirty
  redmine_tags                   3.1.1
  sidebar_hide                   0.0.8

Related issues

Is duplicate of Redmine - Defect #26567: ActionView::Template::Error when trying to access time_entriesClosed

Actions
Actions #1

Updated by Toshi MARUYAMA over 7 years ago

  • Description updated (diff)
Actions #2

Updated by Toshi MARUYAMA over 7 years ago

  • Status changed from New to Closed
  • Priority changed from Urgent to Normal
  • Resolution set to Invalid

QueryFilter#remote is defined at source:tags/3.4.2/app/models/query.rb#L192 .
It seems your plugins are not compatible with Redmine 3.4.

Actions #3

Updated by Toshi MARUYAMA over 7 years ago

  • Related to Defect #26567: ActionView::Template::Error when trying to access time_entries added
Actions #4

Updated by Toshi MARUYAMA over 7 years ago

  • Related to deleted (Defect #26567: ActionView::Template::Error when trying to access time_entries)
Actions #5

Updated by Toshi MARUYAMA over 7 years ago

  • Is duplicate of Defect #26567: ActionView::Template::Error when trying to access time_entries added
Actions #6

Updated by Shinji Tamura almost 7 years ago

I have similar issue in my one environment.

Environment:
  Redmine version                3.4.3.stable.17115
  Ruby version                   2.3.5-p376 (2017-09-14) [x86_64-linux]
  Rails version                  4.2.8
  Environment                    production
  Database adapter               Mysql2
SCM:
  Subversion                     1.7.14
  Git                            1.8.3.1
  Filesystem                     
Redmine plugins:
  clipboard_image_paste          1.12
  computed_custom_field          1.0.6
  lad                            1.5.1
  levm                           2.5.7
  lgc                            3.5.1
  lgc_pro                        3.5.1
  lrm                            1.8.4
  parent_issue_filter            1.0.2
  redmine_banner                 0.1.2
  redmine_base_deface            0.0.1
  redmine_base_select2           4.0.0
  redmine_checklists             3.1.10
  redmine_contacts               4.1.1
  redmine_default_custom_query   1.3.0
  redmine_dmsf                   1.6.0
  redmine_extended_reminder      0.0.1
  redmine_glossary               0.9.2
  redmine_importer               1.2.2
  redmine_issue_templates        0.1.8
  redmine_knowledgebase          3.2.1
  redmine_ldap_sync              2.0.9.devel
  redmine_multiprojects_issue    3.3.0
  redmine_questions              0.0.7
  redmine_startpage              0.1.0
  redmine_tags                   3.2.1
  redmine_wiki_extensions        0.8.1
  redmine_wiki_lists             0.0.9
  redmine_wiki_unc               0.0.3
  redmine_xlsx_format_issue_exporter 0.1.5
  sidebar_hide                   0.0.8
  spectator                      0.0.2
  view_customize                 1.1.4
  wiki_issue_fields              0.5.6
  wiking                         1.0.0b

Error Message is

ActionView::Template::Error (undefined method `remote' for {:name=>"親チケット", :type=>:integer, :order=>42}:Hash):
    1: <%= javascript_tag do %>
    2: var operatorLabels = <%= raw_json Query.operators_labels %>;
    3: var operatorByType = <%= raw_json Query.operators_by_filter_type %>;
    4: var availableFilters = <%= raw_json query.available_filters_as_json %>;
    5: var labelDayPlural = <%= raw_json l(:label_day_plural) %>;
    6:
    7: var filtersUrl = <%= raw_json queries_filter_path(:project_id => @query.project.try(:id), :type => @query.type) %>;
  app/models/query.rb:464:in `block in available_filters_as_json'
  app/models/query.rb:462:in `each'
  app/models/query.rb:462:in `available_filters_as_json'
  plugins/redmine_contacts/lib/redmine_contacts/patches/query_patch.rb:53:in `available_filters_as_json_with_contacts'
  app/views/queries/_filters.html.erb:4:in `block in _3f0b56fb95243a53e40f426ccedfb412'
  app/views/queries/_filters.html.erb:1:in `_3f0b56fb95243a53e40f426ccedfb412'
  app/views/queries/_query_form.html.erb:10:in `_a35a5d9bcb0ca285191237d659c540d5'
  app/views/issues/index.html.erb:11:in `block in _67572b3e36e4c433c79782586d461272'
  app/views/issues/index.html.erb:10:in `_67572b3e36e4c433c79782586d461272'
  app/controllers/issues_controller.rb:51:in `block (2 levels) in index'
  app/controllers/issues_controller.rb:46:in `index'
  plugins/redmine_xlsx_format_issue_exporter/lib/redmine_xlsx_format_issue_exporter/issues_controller_patch.rb:7:in `index'
  lib/redmine/sudo_mode.rb:63:in `sudo_mode'

But redmine_tags seems this plugin is compatible with Redmine 3.4.

Actions #7

Updated by Go MAEDA almost 7 years ago

Shinji Tamura, could you try without redmine_contacts plugin?

Actions #8

Updated by Egon Zemmer over 6 years ago

This is a bug of Redmine!

The variable filter is of type ActiveSupport::OrderedHash and keys should be accessed with [:key_name_as_symbol] and not as method name.

https://github.com/redmine/redmine/blob/3.4.6/app/models/query.rb#L582

diff --git a/app/models/query.rb b/app/models/query.rb
index c8c8986..95d43f5 100644
--- a/app/models/query.rb
+++ b/app/models/query.rb
@@ -461,9 +461,9 @@ class Query < ActiveRecord::Base
     json = {}
     available_filters.each do |field, filter|
       options = {:type => filter[:type], :name => filter[:name]}
-      options[:remote] = true if filter.remote
+      options[:remote] = true if filter[:remote]

-      if has_filter?(field) || !filter.remote
+      if has_filter?(field) || !filter[:remote]
         options[:values] = filter.values
         if options[:values] && values_for(field)
           missing = Array(values_for(field)).select(&:present?) - options[:values].map(&:last)

Pull request: https://github.com/redmine/redmine/pull/109

Actions

Also available in: Atom PDF