Project

General

Profile

Actions

Defect #26637

closed

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

Added by Martin Blom over 6 years ago. Updated over 5 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

Also available in: Atom PDF