Defect #11298

Issue API may not work on Ruby 1.9 in Redmine 1.4

Added by Jan Losinski over 5 years ago. Updated about 5 years ago.

Status:ClosedStart date:
Priority:HighDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:Issues
Target version:1.4.5
Resolution:Fixed Affected version:1.4.4

Description

When you query the issue api in redmine running on Rails 1.9.3 it produces the following error:

Processing IssuesController#index to xml (for 127.0.0.1 at 2012-07-01 20:16:47) [GET]
  Parameters: {"key"=>"xxxxxxx", "fields"=>["status_id"], "operators"=>{"status_id"=>"o"}, "values"=>{"status_id"=>["1"]}, "per_page"=>"10", "controller"=>"issues", "action"=>"index", "project
_id"=>"pycroft", "format"=>"xml"}
Rendering issues/index

ActionView::TemplateError (uninitialized constant Redmine::Views::Builders::Xml::Time) on line #1 of app/views/issues/index.api.rsb:
1: require 'time'
2: logger.fatal(api)
3: api.array :issues, api_meta(:total_count => @issue_count, :offset => @offset, :limit => @limit) do
4:   @issues.each do |issue|

    /usr/lib/ruby/vendor_ruby/active_support/dependencies.rb:131:in `rescue in const_missing'
    /usr/lib/ruby/vendor_ruby/active_support/dependencies.rb:120:in `const_missing'
    lib/redmine/views/builders/xml.rb:25:in `<class:Xml>'
    lib/redmine/views/builders/xml.rb:23:in `<module:Builders>'
    lib/redmine/views/builders/xml.rb:22:in `<module:Views>'
    lib/redmine/views/builders/xml.rb:21:in `<module:Redmine>'
    lib/redmine/views/builders/xml.rb:20:in `<top (required)>'
    /usr/lib/ruby/vendor_ruby/active_support/dependencies.rb:184:in `require'
    /usr/lib/ruby/vendor_ruby/active_support/dependencies.rb:184:in `require'
    /usr/lib/ruby/vendor_ruby/active_support/dependencies.rb:291:in `require_or_load'
    /usr/lib/ruby/vendor_ruby/active_support/dependencies.rb:451:in `load_missing_constant'
    /usr/lib/ruby/vendor_ruby/active_support/dependencies.rb:106:in `const_missing_with_dependencies'
    lib/redmine/views/builders.rb:23:in `for'
    app/views/issues/index.api.rsb:1:in `_run_rsb_app47views47issues47index46api46rsb'
    /usr/lib/ruby/vendor_ruby/action_view/renderable.rb:34:in `block in render'
    /usr/lib/ruby/vendor_ruby/action_view/base.rb:306:in `with_template'
    /usr/lib/ruby/vendor_ruby/action_view/renderable.rb:30:in `render'
    /usr/lib/ruby/vendor_ruby/action_view/template.rb:205:in `render_template'
    /usr/lib/ruby/vendor_ruby/action_view/base.rb:265:in `render'
    /usr/lib/ruby/vendor_ruby/action_controller/base.rb:1252:in `render_for_file'
    /usr/lib/ruby/vendor_ruby/action_controller/base.rb:936:in `render'
    /usr/lib/ruby/vendor_ruby/action_controller/benchmarking.rb:51:in `block in render_with_benchmark'
    /usr/lib/ruby/vendor_ruby/action_controller/benchmarking.rb:51:in `render_with_benchmark'
    /usr/lib/ruby/vendor_ruby/action_controller/base.rb:1328:in `default_render'
    /usr/lib/ruby/vendor_ruby/action_controller/base.rb:1334:in `perform_action'
    /usr/lib/ruby/vendor_ruby/action_controller/filters.rb:617:in `call_filters'
    /usr/lib/ruby/vendor_ruby/action_controller/filters.rb:610:in `perform_action_with_filters'
    /usr/lib/ruby/vendor_ruby/action_controller/benchmarking.rb:68:in `block in perform_action_with_benchmark'
    /usr/lib/ruby/vendor_ruby/action_controller/benchmarking.rb:68:in `perform_action_with_benchmark'
    /usr/lib/ruby/vendor_ruby/action_controller/rescue.rb:160:in `perform_action_with_rescue'
    /usr/lib/ruby/vendor_ruby/action_controller/flash.rb:151:in `perform_action_with_flash'
    /usr/lib/ruby/vendor_ruby/action_controller/base.rb:532:in `process'
    /usr/lib/ruby/vendor_ruby/action_controller/filters.rb:606:in `process_with_filters'
    /usr/lib/ruby/vendor_ruby/action_controller/base.rb:391:in `process'
    /usr/lib/ruby/vendor_ruby/action_controller/base.rb:386:in `call'
    /usr/lib/ruby/vendor_ruby/action_controller/routing/route_set.rb:438:in `call'
    /usr/lib/ruby/vendor_ruby/action_controller/dispatcher.rb:87:in `dispatch'
    /usr/lib/ruby/vendor_ruby/action_controller/dispatcher.rb:121:in `_call'
    /usr/lib/ruby/vendor_ruby/action_controller/dispatcher.rb:130:in `block in build_middleware_stack'
    /usr/lib/ruby/vendor_ruby/active_record/query_cache.rb:29:in `call'
    /usr/lib/ruby/vendor_ruby/active_record/query_cache.rb:29:in `block in call'
    /usr/lib/ruby/vendor_ruby/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'
    /usr/lib/ruby/vendor_ruby/active_record/query_cache.rb:9:in `cache'
    /usr/lib/ruby/vendor_ruby/active_record/query_cache.rb:28:in `call'
    /usr/lib/ruby/vendor_ruby/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'
    /usr/lib/ruby/vendor_ruby/action_controller/string_coercion.rb:25:in `call'
    /usr/lib/ruby/vendor_ruby/rack/head.rb:9:in `call'
    /usr/lib/ruby/vendor_ruby/rack/methodoverride.rb:21:in `call'
    /usr/lib/ruby/vendor_ruby/action_controller/params_parser.rb:15:in `call'
    /usr/lib/ruby/vendor_ruby/action_controller/session/cookie_store.rb:99:in `call'
    /usr/lib/ruby/vendor_ruby/action_controller/failsafe.rb:26:in `call'
    /usr/lib/ruby/vendor_ruby/rack/lock.rb:15:in `call'
    /usr/lib/ruby/vendor_ruby/action_controller/dispatcher.rb:106:in `call'
    /usr/lib/ruby/vendor_ruby/rack/handler/fastcgi.rb:66:in `serve'
    public/dispatch.fcgi:24:in `<main>'

Rendering rescues/layout (internal_server_error)

That results in an 500 internal server error and makes the api useless. You need to prefix The Time class in http://www.redmine.org/projects/redmine/repository/entry/branches/1.4-stable/lib/redmine/views/builders/xml.rb#L32 with :: to tell ruby you mean the Time class from the global Namespace! Otherwise ruby thinks is is a constant in the current namespace.

You do this already in the 2.0 branch like you can see in http://www.redmine.org/projects/redmine/repository/entry/branches/2.0-stable/lib/redmine/views/builders/xml.rb#L34. Please fix this also in 1.4 or do not tell us that 1.4 also works with 1.9.3.

Associated revisions

Revision 10299
Added by Jean-Philippe Lang about 5 years ago

Add namespace to Time (#11298).

History

#1 Updated by Jan Losinski over 5 years ago

Jan Losinski wrote:

When you query the issue api in redmine running on Rails 1.9.3 it produces the following

ruby 1.9.3 ...

#2 Updated by Jean-Philippe Lang over 5 years ago

  • Target version set to 1.4.5

It seems to happen under certain circumstances only because tests are OK with Redmine 1.4.4 and ruby1.9.3:
http://www.redmine.org/builds/index.html

The change you mention was required when upgrading to Rails 3.2 (r9528).

#3 Updated by Jean-Philippe Lang over 5 years ago

What is your exact Redmine version BTW?

#4 Updated by Jan Losinski over 5 years ago

Jean-Philippe Lang wrote:

What is your exact Redmine version BTW?

The "information" in the admin section tells 1.4.4.stable. I installed it from Debian Testing.

ruby --version
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]

#5 Updated by Jean-Philippe Lang about 5 years ago

  • Subject changed from Issue API not working on Ruby 1.9 in Redmine 1.4 to Issue API may not work on Ruby 1.9 in Redmine 1.4
  • Status changed from New to Closed
  • Assignee set to Jean-Philippe Lang
  • Resolution set to Fixed

Change committed in r10299.

Also available in: Atom PDF