Project

General

Profile

Actions

Defect #6750

closed

ActionView::TemplateError (undefined method `empty?' for nil:NilClass) on line #12 of app/views/context_menus/issues.html.erb:

Added by Ве Fio about 14 years ago. Updated about 14 years ago.

Status:
Closed
Priority:
Normal
Category:
Issues
Target version:
Start date:
2010-10-27
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

Visiting this URL always results in a 500 internal server error. The error in the production log has been attached.
http://dev.somedomain.com/issues/context_menu

I found this problematic URL after a search engine navigated to it, and reported it as a problem.

Using::
Redmine 1.0.2
Rails 2.3.5
MySQL 5.1.49
Phusion passenger 2.2.11
Ruby 1.8.7.299

Processing ContextMenusController#issues (for 192.168.1.1 at 2010-10-26 18:59:35) [GET]
  Parameters: {"action"=>"issues", "controller"=>"context_menus"}
Rendering context_menus/issues

ActionView::TemplateError (undefined method `empty?' for nil:NilClass) on line #12 of app/views/context_menus/issues.html.erb:
9:              :class => 'icon-edit', :disabled => !@can[:edit] %></li>
10: <% end %>
11: 
12:   <% unless @allowed_statuses.empty? %>
13:     <li class="folder">                     
14:             <a href="#" class="submenu" onclick="return false;"><%= l(:field_status) %></a>
15:             <ul>

    app/views/context_menus/issues.html.erb:12
    app/controllers/context_menus_controller.rb:36:in `issues'
    /usr/lib/ruby/1.8/phusion_passenger/rack/request_handler.rb:92:in `process_request'
    /usr/lib/ruby/1.8/phusion_passenger/abstract_request_handler.rb:207:in `main_loop'
    /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:418:in `start_request_handler'
    /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:358:in `handle_spawn_application'
    /usr/lib/ruby/1.8/phusion_passenger/utils.rb:184:in `safe_fork'
    /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:354:in `handle_spawn_application'
    /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `__send__'
    /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `main_loop'
    /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
    /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:163:in `start'
    /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:213:in `start'
    /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:262:in `spawn_rails_application'
    /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add'
    /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:256:in `spawn_rails_application'
    /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:80:in `synchronize'
    /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
    /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:255:in `spawn_rails_application'
    /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:154:in `spawn_application'
    /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:287:in `handle_spawn_application'
    /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `__send__'
    /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `main_loop'
    /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
    /usr/lib/phusion_passenger/passenger-spawn-server:61

Rendering /home/user/domains/dev.somedomain.com/public_html/public/500.html (500 Internal Server Error)

Files

production.log (2.69 KB) production.log Ве Fio, 2010-10-27 04:10
Actions #1

Updated by Eric Davis about 14 years ago

  • Subject changed from Visiting specific url causes 500 error to ActionView::TemplateError (undefined method `empty?' for nil:NilClass) on line #12 of app/views/context_menus/issues.html.erb:

Thanks for the bug report.

It's easier if you post the error message into the body of the issue so someone doesn't have to download the file to see the error.

Actions #2

Updated by Ве Fio about 14 years ago

Noted. :)

Actions #3

Updated by Jean-Baptiste Barth about 14 years ago

  • Status changed from New to 7
  • Assignee set to Jean-Baptiste Barth
Two problems at first sight:
  • we should use blank? everywhere, which works with nil, whereas empty? doesn't
  • we should refine HTTP method usable for this action ; today context_menu is accessed through POST, so GET could be blocked at routing level, but we should switch to GET and don't use POST if we want to follow REST principles

I'll look at the first one before tomorrow, but second one won't be addressed in 1.0.3 I think.

Actions #4

Updated by Eric Davis about 14 years ago

Jean-Baptiste Barth wrote:

Two problems at first sight:
  • we should use blank? everywhere, which works with nil, whereas empty? doesn't

+1, or if it's a negative like here use present? and change the unless to an if (if @allowed_statuses.present?)

  • we should refine HTTP method usable for this action ; today context_menu is accessed through POST, so GET could be blocked at routing level, but we should switch to GET and don't use POST if we want to follow REST principles

I think GET is better. Since the parameters passed to the context menu don't change anything on the server, GET is safe. Should we open a new issue for this?

Actions #5

Updated by Jean-Baptiste Barth about 14 years ago

Eric Davis wrote:

I think GET is better. Since the parameters passed to the context menu don't change anything on the server, GET is safe. Should we open a new issue for this?

Yes, I'll do.

Actions #6

Updated by Jean-Baptiste Barth about 14 years ago

  • Status changed from 7 to Resolved
  • Target version set to 1.0.3
  • Resolution set to Fixed

Original problem fixed in r4302. I'll open new issues for the other things we mentionned.

Actions #7

Updated by Eric Davis about 14 years ago

  • Status changed from Resolved to Closed

Merged into 1.0-stable for release in 1.0.3

Actions

Also available in: Atom PDF