Hi,
Sorry, I am not sure where to ask the question. I was following the
book Agile Web D. tutorial about creating Admin users login
for to manage the products. I have successfully created new user, but
when i try to login in, i have this error message…
=============
TypeError in LoginController#login
can’t convert String into Array
RAILS_ROOT: C:/INSTAN~1/rails_apps/depot/config/…
Application Trace | Framework Trace | Full Trace
#{RAILS_ROOT}/app/models/user.rb:43:in +' #{RAILS_ROOT}/app/models/user.rb:43:in
encrypted_password’
#{RAILS_ROOT}/app/models/user.rb:29:in authenticate' #{RAILS_ROOT}/app/controllers/login_controller.rb:15:in
login’
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/base.rb:1095:in send' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/base.rb:1095:in
perform_action_without_filters’
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/filters.rb:632:in call_filter' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/filters.rb:619:in
perform_action_without_benchmark’
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/benchmarking.rb:66:in
perform_action_without_rescue' C:/INSTAN~1/ruby/lib/ruby/1.8/benchmark.rb:293:in
measure’
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/benchmarking.rb:66:in
perform_action_without_rescue' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/rescue.rb:83:in
perform_action’
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/base.rb:430:in send' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/base.rb:430:in
process_without_filters’
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/filters.rb:624:in
process_without_session_management_support' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/session_management.rb:114:in
process’
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/base.rb:330:in process' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/dispatcher.rb: 41:in
dispatch’
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/
mongrel/rails.rb:78:in process' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/ mongrel/rails.rb:76:in
synchronize’
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/
mongrel/rails.rb:76:in process' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/ mongrel.rb:618:in
process_client’
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/
mongrel.rb:617:in each' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/ mongrel.rb:617:in
process_client’
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/
mongrel.rb:736:in run' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/ mongrel.rb:736:in
initialize’
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/
mongrel.rb:736:in new' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/ mongrel.rb:736:in
run’
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/
mongrel.rb:720:in initialize' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/ mongrel.rb:720:in
new’
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/
mongrel.rb:720:in run' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/ mongrel/configurator.rb:271:in
run’
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/
mongrel/configurator.rb:270:in each' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/ mongrel/configurator.rb:270:in
run’
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/bin/
mongrel_rails:127:in run' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/ mongrel/command.rb:211:in
run’
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/bin/
mongrel_rails:243
C:/INSTAN~1/ruby/bin/mongrel_rails:16:in `load’
C:/INSTAN~1/ruby/bin/mongrel_rails:16
#{RAILS_ROOT}/app/models/user.rb:43:in +' #{RAILS_ROOT}/app/models/user.rb:43:in
encrypted_password’
#{RAILS_ROOT}/app/models/user.rb:29:in authenticate' #{RAILS_ROOT}/app/controllers/login_controller.rb:15:in
login’
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/base.rb:1095:in send' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/base.rb:1095:in
perform_action_without_filters’
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/filters.rb:632:in call_filter' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/filters.rb:619:in
perform_action_without_benchmark’
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/benchmarking.rb:66:in
perform_action_without_rescue' C:/INSTAN~1/ruby/lib/ruby/1.8/benchmark.rb:293:in
measure’
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/benchmarking.rb:66:in
perform_action_without_rescue' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/rescue.rb:83:in
perform_action’
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/base.rb:430:in send' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/base.rb:430:in
process_without_filters’
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/filters.rb:624:in
process_without_session_management_support' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/session_management.rb:114:in
process’
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/base.rb:330:in process' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/dispatcher.rb: 41:in
dispatch’
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/
mongrel/rails.rb:78:in process' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/ mongrel/rails.rb:76:in
synchronize’
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/
mongrel/rails.rb:76:in process' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/ mongrel.rb:618:in
process_client’
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/
mongrel.rb:617:in each' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/ mongrel.rb:617:in
process_client’
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/
mongrel.rb:736:in run' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/ mongrel.rb:736:in
initialize’
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/
mongrel.rb:736:in new' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/ mongrel.rb:736:in
run’
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/
mongrel.rb:720:in initialize' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/ mongrel.rb:720:in
new’
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/
mongrel.rb:720:in run' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/ mongrel/configurator.rb:271:in
run’
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/
mongrel/configurator.rb:270:in each' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/ mongrel/configurator.rb:270:in
run’
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/bin/
mongrel_rails:127:in run' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/ mongrel/command.rb:211:in
run’
C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/bin/
mongrel_rails:243
C:/INSTAN~1/ruby/bin/mongrel_rails:16:in `load’
C:/INSTAN~1/ruby/bin/mongrel_rails:16
Request
Parameters: {“name”=>“paco”, “commit”=>“Login”, “password”=>“12345”}
Show session dump
:user_id:
flash: !map:ActionController::Flash::FlashHash {}
Response
Headers: {“cookie”=>[], “Cache-Control”=>“no-cache”}
very strange. attached is my model/user.rb file. I did another test,
to try to use a wrong username, i got a response saying “Invalid user/
password combination”
So, looks like the
def self.encrypted_password(password, salt)
string_to_hash = password + “wibble” + salt
Digest::SHA1.hexdigest(string_to_hash)
end
string_to_hash gives me error !
Please help or point me to the right direction to solve this
issue…otherwise, i can not proceed with the rest of the
chapters…
I am using Window XP and InstantRails to develop this application,
using MYSQL.
your help is greatly appreciated !
thks