Project

General

Profile

get "wrong number of arguments"

Added by song hui almost 12 years ago

Update redmine from 1.2.1 to 2.2 (checkout from svn http://svn.redmine.org/redmine/branches/2.2-stable revision: 11060)

my env:

ruby 1.8.7 (2008-05-31 patchlevel 0) [i686-linux]
rails (3.2.9)
actionmailer (3.2.9)
actionpack (3.2.9)
activemodel (3.2.9)
activerecord (3.2.9)
activeresource (3.2.9)
activesupport (3.2.9)
i18n (0.6.1)
......

When I try to check "my account", get this error:

Started GET "/my/account" for 192.168.23.33 at Fri Dec 21 12:09:50 +0800 2012
Processing by MyController#account as HTML
  Current user: test (id=3)
  Rendered my/account.html.erb within layouts/base (8.6ms)
Completed 500 Internal Server Error in 16ms

ActionView::Template::Error (wrong number of arguments (2 for 1)):
    16:   <p><%= f.text_field :firstname, :required => true %></p>
    17:   <p><%= f.text_field :lastname, :required => true %></p>
    18:   <p><%= f.text_field :mail, :required => true %></p>
    19:   <p><%= f.select :language, lang_options_for_select %></p>
    20:   <% if Setting.openid? %>
    21:   <p><%= f.text_field :identity_url  %></p>
    22:   <% end %>
  lib/redmine/i18n.rb:95:in `languages_options'
  app/helpers/application_helper.rb:974:in `lang_options_for_select'
  app/views/my/account.html.erb:19:in `_app_views_my_account_html_erb___278591561__616683068'
  app/helpers/application_helper.rb:989:in `labelled_form_for'
  app/views/my/account.html.erb:9:in `_app_views_my_account_html_erb___278591561__616683068'

Is it related with plugins or something else?
Someone help me out....


Replies (6)

RE: get "wrong number of arguments" - Added by song hui almost 12 years ago

I replaced the “lang_options_for_select” code wiht the old one(from 1.2.1), and it works just fine,can any one tell me why?

I am not familiar with ruby or rails...

RE: get "wrong number of arguments" - Added by song hui almost 12 years ago

Problem solved.

Update ruby from 1.8.7 to 1.9.3, error gone.

or

Replace the "lang_options_for_select" code at application _helper.rb with old version:

 def lang_options_for_select(blank=true)
-    (blank ? [["(auto)", ""]] : []) + languages_options
+    (blank ? [["(auto)", ""]] : []) +
+     valid_languages.collect{|lang| [ ll(lang.to_s, :general_lang_name), lang.to_s]}.sort{|x,y| x.last <=> y.last }
 end

RE: get "wrong number of arguments" - Added by Anonymous over 11 years ago

The same problem when i click on setting in ADministration:

@Started GET "/settings" for 113.122.113.227 at Fri Feb 22 15:21:03 +0700 2013
Processing by SettingsController#index as HTML
  Current user: admins (id=9)
  Rendered settings/_general.html.erb (6.5ms)
  Rendered settings/_display.html.erb (5.6ms)
  Rendered common/_tabs.html.erb (16.1ms)
  Rendered settings/edit.html.erb within layouts/admin (16.5ms)
Completed 500 Internal Server Error in 22ms

ActionView::Template::Error (wrong number of arguments (2 for 1)):
    3: <div class="box tabular settings">
    4: <p><%= setting_select :ui_theme, Redmine::Themes.themes.collect {|t| [t.name, t.id]}, :blank => :label_default, :label => :label_theme %></p>
    5: 
    6: <p><%= setting_select :default_language, lang_options_for_select(false) %></p>
    7: 
    8: <p><%= setting_select :start_of_week, [[day_name(1),'1'], [day_name(6),'6'], [day_name(7),'7']], :blank => :label_language_based %></p>
    9: <% locale = User.current.language.blank? ? ::I18n.locale : User.current.language %>
  lib/redmine/i18n.rb:95:in `languages_options'
  app/helpers/application_helper.rb:976:in `lang_options_for_select'
  app/views/settings/_display.html.erb:6:in `_app_views_settings__display_html_erb___984120646__615536268'
  app/views/settings/_display.html.erb:1:in `_app_views_settings__display_html_erb___984120646__615536268'
  app/views/common/_tabs.html.erb:24:in `_app_views_common__tabs_html_erb__198011467__614894728'
  app/views/common/_tabs.html.erb:23:in `each'
  app/views/common/_tabs.html.erb:23:in `_app_views_common__tabs_html_erb__198011467__614894728'
  app/helpers/application_helper.rb:263:in `render_tabs'
  app/views/settings/edit.html.erb:3:in `_app_views_settings_edit_html_erb__613101952__615350148'
  app/controllers/settings_controller.rb:26:in `index'
@

My gem list:

@*** LOCAL GEMS ***
ruby 1.8.7 (2008-05-31 patchlevel 0) [i686-linux]
Using rake (10.0.3)
Using i18n (0.6.1)
Using multi_json (1.6.1)
Using activesupport (3.2.12)
Using builder (3.0.0)
Using activemodel (3.2.12)
Using erubis (2.7.0)
Using journey (1.0.4)
Using rack (1.4.5)
Using rack-cache (1.2)
Using rack-test (0.6.2)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.2.2)
Using actionpack (3.2.12)
Using mime-types (1.21)
Using polyglot (0.3.3)
Using treetop (1.4.12)
Using mail (2.4.4)
Using actionmailer (3.2.12)
Using arel (3.0.2)
Using tzinfo (0.3.35)
Using activerecord (3.2.12)
Using activeresource (3.2.12)
Using coderay (1.0.9)
Using fastercsv (1.5.5)
Using rack-ssl (1.3.3)
Using json (1.7.7)
Using rdoc (3.12.1)
Using thor (0.17.0)
Using railties (3.2.12)
Using jquery-rails (2.0.3)
Using mysql (2.8.1)
Using net-ldap (0.3.1)
Using ruby-openid (2.1.8)
Using rack-openid (1.3.1)
Using bundler (1.1.3)
Using rails (3.2.12)
Using rmagick (2.13.2)
@

RE: get "wrong number of arguments" - Added by Jan Niggemann (redmine.org team member) over 11 years ago

The answer is one post above your own post. It starts with the words "Problem solved".

RE: get "wrong number of arguments" - Added by Anonymous over 11 years ago

When I had installed Ruby 1.9.3-p374, the new problem is:

A source file that the application requires, is missing.

    It is possible that you didn't upload your application files correctly. Please check whether all your application files are uploaded.
    A required library may not installed. Please install all libraries that this application requires.

Further information about the error may have been written to the application's log file. Please check it in order to analyse the problem.

Error message:
    Please install the mysql adapter: `gem install activerecord-mysql-adapter` (mysql is not part of the bundle. Add it to Gemfile.)

I typed: gem install activerecord-mysql-adapter
successed

But problem not gone :(

RE: get "wrong number of arguments" - Added by Anonymous over 11 years ago

The problem is on my file config/database.yml, edit it and change

adapter: mysql

to
adapter: mysql2

Problem is gone!

thanks.

    (1-6/6)