Defect #10135

ActionView::TemplateError (can't convert Fixnum into String)

Added by shahul hameed almost 6 years ago. Updated over 5 years ago.

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

0%

Category:Projects
Target version:1.3.2
Resolution:Fixed Affected version:1.2.3

Description

Hi

I have migrated my Redmine 1.0.2 to 1.2.1. Everything was good and the migrate DB generated no error or warming,
For the testing purpose i ran the redmine in webrick
The login page appear and I can login, but the next page got a 500.html error with the folling log.

Please help me its urgent

Thanks
Shahul

ERROR LOG IS:

ActionView::TemplateError (can't convert Fixnum into String) on line #43 of app/views/layouts/base.rhtml:
40:         <%= link_to l(:label_search), {:controller => 'search', :action => 'index', :id => @project}, :accesskey => accesskey(:search) %>:
41:         <%= text_field_tag 'q', @question, :size => 20, :class => 'small', :accesskey => accesskey(:quick_search) %>
42:         <% end %>
43:         <%= render_project_jump_box %>
44:     </div>
45:     <% end %>
46:     

    app/helpers/application_helper.rb:233:in `render_project_jump_box'
    app/helpers/application_helper.rb:250:in `project_tree_options_for_select'
    app/models/project.rb:664:in `project_tree'
    app/models/project.rb:660:in `each'
    app/models/project.rb:660:in `project_tree'
    app/helpers/application_helper.rb:260:in `project_tree'
    app/helpers/application_helper.rb:242:in `project_tree_options_for_select'
    app/helpers/application_helper.rb:232:in `render_project_jump_box'
    app/views/layouts/base.rhtml:43:in `_run_rhtml_app47views47layouts47base46rhtml'
    /usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
    /usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
    /usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
    /usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
    /usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
    /usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
    /usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
    /usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
    /usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
    /usr/lib/ruby/1.8/webrick/server.rb:82:in `start'

Associated revisions

Revision 8804
Added by Jean-Philippe Lang almost 6 years ago

Fixed "can't convert Fixnum into String" error on projects with numerical identifier (#10135).

History

#1 Updated by Jean-Philippe Lang almost 6 years ago

  • Description updated (diff)
  • Resolution set to Cant reproduce

You upgraded to 1.2.1 but you report this issue against 1.2.3. So what version are you using?

#2 Updated by Jean-Philippe Lang almost 6 years ago

  • Assignee deleted (Felix Schäfer)

And please, don't assign issues.

#3 Updated by shahul hameed almost 6 years ago

sorry, i have upgraded my redmine from 1.0.2 to 1.2.3

#4 Updated by Bernhard Baumgartl almost 6 years ago

Hi i have the same issue.

I upgraded from 1.0.1 to 1.1.3.

I found out that all project related templating e.g. "link_to_project", "render_project_jump_box", ..., is not working.

Is that maybe an ruby package with an false version?

My installed packeges are:

actionmailer (3.2.1, 2.3.11)
actionpack (3.2.1, 2.3.11)
activemodel (3.2.1)
activerecord (3.2.1, 2.3.11)
activeresource (3.2.1, 2.3.11)
activesupport (3.2.1, 2.3.11)
acts-as-taggable-on (2.1.1)
arel (3.0.0)
builder (3.0.0)
bundler (1.0.21)
daemon_controller (0.2.5)
erubis (2.7.0)
fastthread (1.0.7)
file-tail (1.0.5)
hike (1.2.1)
i18n (0.6.0)
journey (1.0.1)
json (1.6.5)
mail (2.4.1)
mime-types (1.17.2)
multi_json (1.0.4)
oniguruma (1.1.0)
passenger (3.0.2)
plist (3.1.0)
polyglot (0.3.3)
rack (1.4.1, 1.2.1, 1.1.3)
rack-cache (1.1)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (2.3.11)
railties (3.2.1)
rake (0.8.7)
rdoc (3.12)
sprockets (2.1.2)
spruz (0.2.2)
textpow (0.10.1)
thor (0.14.6)
treetop (1.4.10)
tzinfo (0.3.31)

Thx for the help.

#5 Updated by Jean-Philippe Lang almost 6 years ago

  • Category set to Projects
  • Status changed from New to Resolved
  • Assignee set to Jean-Philippe Lang
  • Target version set to 1.3.2
  • Resolution changed from Cant reproduce to Fixed

OK, found. You must have at least one project with a legacy numerical identifier (which is no longer valid).
The fix is committed in r8804, but it can be easily applied locally:

Index: app/models/project.rb
===================================================================
--- app/models/project.rb    (revision 8776)
+++ app/models/project.rb    (working copy)
@@ -274,7 +274,7 @@

   def to_param
     # id is used for projects with a numeric identifier (compatibility)
-    @to_param ||= (identifier.to_s =~ %r{^\d*$} ? id : identifier)
+    @to_param ||= (identifier.to_s =~ %r{^\d*$} ? id.to_s : identifier)
   end

   def active?

This patch is against current trunk but you should be able to locate this piece of code in 1.1.3 or 1.2.3.
Alternatively, you can change your project identifier(s) to non-numerical ones.

#6 Updated by Bernhard Baumgartl almost 6 years ago

Hi thx for the fix,

i found the problem by my self and added before all numeric identifiers a letter. ;)

But i spent 4 hours to found it. xD

#7 Updated by shahul hameed almost 6 years ago

thank u so much Jean-Philippe Lang, the issue has been fixed and its works for me

Thanks
Shahul

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

  • Status changed from Resolved to Closed

Merged. Thanks for the feedback.

Also available in: Atom PDF