Error message after upgrading to Gusty Gibbon Ubuntu

I have started to get the error message “wrong number of arguments (1
for 0)” since I upgraded to Gusty Gibbon.

I am new to ROR so I have no clue.

This is the code that was running
def create
@user = User.new(params[:user])
if @user.save
flash[:notice] = ‘User was successfully created.’
redirect_to :action => ‘list’
else
render :action => ‘new’
end
end

andf this is the stack trace any help would be appreciated

ArgumentError in Access/userController#create

wrong number of arguments (1 for 0)

RAILS_ROOT: script/…/config/…
Application Trace | Framework Trace | Full Trace

app/models/user.rb:17:in initialize' app/models/user.rb:17:innew’
app/models/user.rb:17:in hashed' app/models/user.rb:35:inupdate_password’
/var/lib/gems/1.8/gems/activerecord-1.15.1/lib/active_record/
callbacks.rb:333:in send' /var/lib/gems/1.8/gems/activerecord-1.15.1/lib/active_record/ callbacks.rb:333:incallback’
/var/lib/gems/1.8/gems/activerecord-1.15.1/lib/active_record/
callbacks.rb:330:in each' /var/lib/gems/1.8/gems/activerecord-1.15.1/lib/active_record/ callbacks.rb:330:incallback’
/var/lib/gems/1.8/gems/activerecord-1.15.1/lib/active_record/
callbacks.rb:241:in create_or_update' /var/lib/gems/1.8/gems/activerecord-1.15.1/lib/active_record/base.rb: 1533:insave_without_validation’
/var/lib/gems/1.8/gems/activerecord-1.15.1/lib/active_record/
validations.rb:752:in save_without_transactions' /var/lib/gems/1.8/gems/activerecord-1.15.1/lib/active_record/ transactions.rb:129:insave’
/var/lib/gems/1.8/gems/activerecord-1.15.1/lib/active_record/
connection_adapters/abstract/database_statements.rb:59:in
transaction' /var/lib/gems/1.8/gems/activerecord-1.15.1/lib/active_record/ transactions.rb:95:intransaction’
/var/lib/gems/1.8/gems/activerecord-1.15.1/lib/active_record/
transactions.rb:121:in transaction' /var/lib/gems/1.8/gems/activerecord-1.15.1/lib/active_record/ transactions.rb:129:insave’
app/controllers/access/user_controller.rb:29:in create' /var/lib/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/base.rb: 1095:insend’
/var/lib/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/base.rb:
1095:in perform_action_without_filters' /var/lib/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/ filters.rb:632:incall_filter’
/var/lib/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
filters.rb:638:in call_filter' /var/lib/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/ filters.rb:438:incall’
/var/lib/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
filters.rb:637:in call_filter' /var/lib/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/ filters.rb:638:incall_filter’
/var/lib/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
filters.rb:438:in call' /var/lib/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/ filters.rb:637:incall_filter’
/var/lib/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
filters.rb:619:in perform_action_without_benchmark' /var/lib/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/ benchmarking.rb:66:inperform_action_without_rescue’
/var/lib/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
benchmarking.rb:66:in perform_action_without_rescue' /var/lib/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/ rescue.rb:83:inperform_action’
/var/lib/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/base.rb:
430:in send' /var/lib/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/base.rb: 430:inprocess_without_filters’
/var/lib/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
filters.rb:624:in process_without_session_management_support' /var/lib/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/ session_management.rb:114:inprocess’
/var/lib/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/base.rb:
330:in process' /var/lib/gems/1.8/gems/rails-1.2.1/lib/webrick_server.rb:79:inservice’
/var/lib/gems/1.8/gems/rails-1.2.1/lib/commands/servers/webrick.rb:59
/var/lib/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
dependencies.rb:496:in require' /var/lib/gems/1.8/gems/activesupport-1.4.0/lib/active_support/ dependencies.rb:343:innew_constants_in’
/var/lib/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
dependencies.rb:496:in require' /var/lib/gems/1.8/gems/rails-1.2.1/lib/commands/server.rb:39 -e:4:inload’
-e:4

/usr/lib/ruby/1.8/benchmark.rb:293:in measure' /var/lib/gems/1.8/gems/rails-1.2.1/lib/dispatcher.rb:41:indispatch’
/var/lib/gems/1.8/gems/rails-1.2.1/lib/webrick_server.rb:113:in
handle_dispatch' /usr/lib/ruby/1.8/webrick/httpserver.rb:104:inservice’
/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in run' /usr/lib/ruby/1.8/webrick/server.rb:173:instart_thread’
/usr/lib/ruby/1.8/webrick/server.rb:162:in start' /usr/lib/ruby/1.8/webrick/server.rb:162:instart_thread’
/usr/lib/ruby/1.8/webrick/server.rb:95:in start' /usr/lib/ruby/1.8/webrick/server.rb:92:ineach’
/usr/lib/ruby/1.8/webrick/server.rb:92:in start' /usr/lib/ruby/1.8/webrick/server.rb:23:instart’
/usr/lib/ruby/1.8/webrick/server.rb:82:in start' /var/lib/gems/1.8/gems/rails-1.2.1/lib/webrick_server.rb:63:indispatch’
/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in
gem_original_require' /usr/lib/ruby/1.8/rubygems/custom_require.rb:27:inrequire’
/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in
gem_original_require' /usr/lib/ruby/1.8/rubygems/custom_require.rb:27:inrequire’
script/server:5

app/models/user.rb:17:in initialize' app/models/user.rb:17:innew’
app/models/user.rb:17:in hashed' app/models/user.rb:35:inupdate_password’
/var/lib/gems/1.8/gems/activerecord-1.15.1/lib/active_record/
callbacks.rb:333:in send' /var/lib/gems/1.8/gems/activerecord-1.15.1/lib/active_record/ callbacks.rb:333:incallback’
/var/lib/gems/1.8/gems/activerecord-1.15.1/lib/active_record/
callbacks.rb:330:in each' /var/lib/gems/1.8/gems/activerecord-1.15.1/lib/active_record/ callbacks.rb:330:incallback’
/var/lib/gems/1.8/gems/activerecord-1.15.1/lib/active_record/
callbacks.rb:241:in create_or_update' /var/lib/gems/1.8/gems/activerecord-1.15.1/lib/active_record/base.rb: 1533:insave_without_validation’
/var/lib/gems/1.8/gems/activerecord-1.15.1/lib/active_record/
validations.rb:752:in save_without_transactions' /var/lib/gems/1.8/gems/activerecord-1.15.1/lib/active_record/ transactions.rb:129:insave’
/var/lib/gems/1.8/gems/activerecord-1.15.1/lib/active_record/
connection_adapters/abstract/database_statements.rb:59:in
transaction' /var/lib/gems/1.8/gems/activerecord-1.15.1/lib/active_record/ transactions.rb:95:intransaction’
/var/lib/gems/1.8/gems/activerecord-1.15.1/lib/active_record/
transactions.rb:121:in transaction' /var/lib/gems/1.8/gems/activerecord-1.15.1/lib/active_record/ transactions.rb:129:insave’
app/controllers/access/user_controller.rb:29:in create' /var/lib/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/base.rb: 1095:insend’
/var/lib/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/base.rb:
1095:in perform_action_without_filters' /var/lib/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/ filters.rb:632:incall_filter’
/var/lib/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
filters.rb:638:in call_filter' /var/lib/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/ filters.rb:438:incall’
/var/lib/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
filters.rb:637:in call_filter' /var/lib/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/ filters.rb:638:incall_filter’
/var/lib/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
filters.rb:438:in call' /var/lib/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/ filters.rb:637:incall_filter’
/var/lib/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
filters.rb:619:in perform_action_without_benchmark' /var/lib/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/ benchmarking.rb:66:inperform_action_without_rescue’
/usr/lib/ruby/1.8/benchmark.rb:293:in measure' /var/lib/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/ benchmarking.rb:66:inperform_action_without_rescue’
/var/lib/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
rescue.rb:83:in perform_action' /var/lib/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/base.rb: 430:insend’
/var/lib/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/base.rb:
430:in process_without_filters' /var/lib/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/ filters.rb:624:inprocess_without_session_management_support’
/var/lib/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/
session_management.rb:114:in process' /var/lib/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/base.rb: 330:inprocess’
/var/lib/gems/1.8/gems/rails-1.2.1/lib/dispatcher.rb:41:in dispatch' /var/lib/gems/1.8/gems/rails-1.2.1/lib/webrick_server.rb:113:inhandle_dispatch’
/var/lib/gems/1.8/gems/rails-1.2.1/lib/webrick_server.rb:79:in
service' /usr/lib/ruby/1.8/webrick/httpserver.rb:104:inservice’
/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in run' /usr/lib/ruby/1.8/webrick/server.rb:173:instart_thread’
/usr/lib/ruby/1.8/webrick/server.rb:162:in start' /usr/lib/ruby/1.8/webrick/server.rb:162:instart_thread’
/usr/lib/ruby/1.8/webrick/server.rb:95:in start' /usr/lib/ruby/1.8/webrick/server.rb:92:ineach’
/usr/lib/ruby/1.8/webrick/server.rb:92:in start' /usr/lib/ruby/1.8/webrick/server.rb:23:instart’
/usr/lib/ruby/1.8/webrick/server.rb:82:in start' /var/lib/gems/1.8/gems/rails-1.2.1/lib/webrick_server.rb:63:indispatch’
/var/lib/gems/1.8/gems/rails-1.2.1/lib/commands/servers/webrick.rb:59
/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in
gem_original_require' /usr/lib/ruby/1.8/rubygems/custom_require.rb:27:inrequire’
/var/lib/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
dependencies.rb:496:in require' /var/lib/gems/1.8/gems/activesupport-1.4.0/lib/active_support/ dependencies.rb:343:innew_constants_in’
/var/lib/gems/1.8/gems/activesupport-1.4.0/lib/active_support/
dependencies.rb:496:in require' /var/lib/gems/1.8/gems/rails-1.2.1/lib/commands/server.rb:39 /usr/lib/ruby/1.8/rubygems/custom_require.rb:27:ingem_original_require’
/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in require' script/server:5 -e:4:inload’
-e:4

Request

Parameters: {“user”=>{“lastName”=>“Bragg”,
“username”=>“percivalbragg”, “firstName”=>“Percival”,
“phone”=>“315-457-3000”, “fax”=>"", “password”=>“kin2ja”,
“active”=>“t”, “email”=>“[email protected]”},
“commit”=>“Create”}

Show session dump


flash: !map:ActionController::Flash::FlashHash {}

Response
Headers: {“cookie”=>[], “Cache-Control”=>“no-cache”}

On 29 Oct 2007, at 16:53, Percival wrote:

  flash[:notice] = 'User was successfully created.'

wrong number of arguments (1 for 0)

RAILS_ROOT: script/…/config/…
Application Trace | Framework Trace | Full Trace

Well there’a clearly something interesting happening here

app/models/user.rb:17:in initialize' app/models/user.rb:17:innew’
app/models/user.rb:17:in hashed' app/models/user.rb:35:inupdate_password’

but you haven’t shown us what’s in that file so it’s hard to guess
what might be wrong

Fred

Here is the model users.rb

class User < ActiveRecord::Base

has_and_belongs_to_many :groups

attr_accessor :password
attr_protected :hashed_password

validates_uniqueness_of :username

validates_confirmation_of :password,
:if => lambda{|user| user.new_record? or not user.password.blank?}

validates_length_of :password, :within => 6…20,
:if => lambda{|user| user.new_record? or not user.password.blank?}

def self.hashed(str)
Digest::SHA1.new(str).to_s
end

If user matching the credentials is found, return User object

if no matching user is found, return nil

def self.authenticate(user_info)
user = find_by_username(user_info[:username])
if user && user.hashed_password == hashed(user_info[:password])
return user
end
end

private
before_save :update_password

Updates the hashed_password if a plain password was provided

def update_password
if not password.blank?
self.hashed_password = self.class.hashed(password)
end
end

end

Hope this helps.

On Oct 29, 1:16 pm, Frederick C. [email protected]