ixti / redmine_tags

Redmine plugin, that adds issues tagging support
GNU General Public License v3.0
196 stars 119 forks source link

undefined method `open' for #<ActiveRecord::Relation [#<WikiPage id: 465>]>] #119

Closed gravis closed 8 years ago

gravis commented 8 years ago

Hi,

I can't browse wiki pages when redmine_tags is installed. I have pulled the latest master today with the same result:

Started GET "/projects/foo/wiki" for xx.xx.xx.xx at 2015-12-31 16:13:47 +0100
Processing by WikiController#show as HTML
  Parameters: {"project_id"=>"foo"}
  Current user: gravis (id=3)
  Rendered wiki/_content.html.erb (5.9ms)
  Rendered attachments/_form.html.erb (1.7ms)
  Rendered wiki/_sidebar.html.erb (1.6ms)
  Rendered wiki/show.html.erb within layouts/base (15.0ms)
  Rendered inline template (0.6ms)
  Rendered plugins/redmine_tags/app/views/wiki/_tags_sidebar.html.erb (2.3ms)
Completed 500 Internal Server Error in 55ms (ActiveRecord: 6.7ms)

ActionView::Template::Error (undefined method `open' for #<ActiveRecord::Relation [#<WikiPage id: 465>]>):
    1: <% unless sidebar_tags.empty? %>
    2:   <%= stylesheet_link_tag 'jquery.tagit.css', plugin: 'redmine_tags' %>
    3:   <%= stylesheet_link_tag 'redmine_tags', plugin: 'redmine_tags' %>
    4:   <h3><%= l :tags %></h3>
  lib/redmine/hook.rb:61:in `block (2 levels) in call_hook'
  lib/redmine/hook.rb:61:in `each'
  lib/redmine/hook.rb:61:in `block in call_hook'
  lib/redmine/hook.rb:58:in `tap'
  lib/redmine/hook.rb:58:in `call_hook'
  lib/redmine/hook.rb:167:in `call_hook'
  app/helpers/application_helper.rb:1230:in `view_layouts_base_sidebar_hook_response'
  app/views/layouts/base.html.erb:54:in `_app_views_layouts_base_html_erb__1954268719030526772_39025700'
  app/controllers/wiki_controller.rb:97:in `show'
  lib/redmine/sudo_mode.rb:63:in `sudo_mode'

It's the same for all wiki pages.

Environment

  Redmine version                3.1.3.stable
  Ruby version                   2.2.3-p173 (2015-08-18) [x86_64-linux]
  Rails version                  4.2.5
  Environment                    production
  Database adapter               PostgreSQL
PowerKiKi commented 8 years ago

Same here with redmine_tags on e9ebd7e4 and Redmine latest stable 3.2.0 without any other plugins:

Environment:
  Redmine version                3.2.0.stable
  Ruby version                   2.1.5-p273 (2014-11-13) [x86_64-linux-gnu]
  Rails version                  4.2.5
  Environment                    development
  Database adapter               Mysql2
SCM:
  Subversion                     1.8.13
  Bazaar                         2.7.0
  Git                            2.5.0
  Filesystem                     
Redmine plugins:
  redmine_tags                   3.1.0
ghost commented 8 years ago

I have the same problem with Redmine 3.2.

I solved it by commenting out the following line in file wiki_page_patch.rb

      # ids_scope = ids_scope.open if options[:open_only]
sdwolfz commented 8 years ago

@sergeyb49 indeed that is the fix. Would you like to submit a PR removing that line and the documentation for the 'open_only' option above?

sdwolfz commented 8 years ago

This is now fixed on master