0

I referred this Migrating from Authlogic to Devise and followed it to get the database structure required by devise ready. However I get this error on my sign_in page

wrong number of arguments (2 for 1)

This is my Request:

{"commit"=>"Sign in","authenticity_token"=>"oWXrE+EdhO4ScuaBzPBqCnpYsal1QcDC483ygVSs0fw=","user"=>{"password"=>"password", "email"=>"email@email.com"}}

I'm using Rails 2.3.8 and hence using Devise v 1.0.

This is my sessions/new view :

<% form_for resource_name, resource, :url => session_path(resource_name) do |f| -%>
  <p><%= f.label :email %></p>
  <p><%= f.text_field :email %></p>
  <p><%= f.label :password %></p>
  <p><%= f.password_field :password %></p>

  <p><%= f.submit "Sign in" %></p>
<% end -%>

Any ideas to get this to work? Thanks !

EDIT

Here's the stack trace:

ArgumentError (wrong number of arguments (2 for 1)):
devise (1.0.8) lib/devise/models/database_authenticatable.rb:139:in `find_for_authentication'
devise (1.0.8) lib/devise/models/database_authenticatable.rb:117:in `authenticate'
devise (1.0.8) lib/devise/strategies/database_authenticatable.rb:16:in `authenticate!'
warden (1.0.3) lib/warden/strategies/base.rb:53:in `_run!'
warden (1.0.3) lib/warden/proxy.rb:303:in `_run_strategies_for'
warden (1.0.3) lib/warden/proxy.rb:298:in `each'
warden (1.0.3) lib/warden/proxy.rb:298:in `_run_strategies_for'
warden (1.0.3) lib/warden/proxy.rb:271:in `_perform_authentication'
warden (1.0.3) lib/warden/proxy.rb:90:in `authenticate'
devise (1.0.8) lib/devise/controllers/helpers.rb:36:in `authenticate'
devise (1.0.8) app/controllers/sessions_controller.rb:19:in `create'
warden (1.0.3) lib/warden/manager.rb:35:in `call'
warden (1.0.3) lib/warden/manager.rb:34:in `catch'
warden (1.0.3) lib/warden/manager.rb:34:in `call'

Anything to do with warden dependency?

Community
  • 1
  • 1
Shreyas
  • 8,737
  • 7
  • 44
  • 56
  • The error doesn't seem to be in your sessions/new view, everything looks fine to me there. Does the error give any more details in the "Application Trace" about where the error occurred? – aNoble Dec 14 '10 at 17:02

2 Answers2

1

I had the same problem, using warden 0.10.7 and devise 1.0.8 I tried the User.find in the console and was OK.

To fix it, I removed the class method authenticate on my User-Model:

#def self.authenticate(login, pass)
#  find(:first, :conditions => ["login = ? AND password = ?", login, sha1(pass)])
#end
jigfox
  • 18,057
  • 3
  • 60
  • 73
lbois
  • 11
  • 1
0

The error seems to be occuring in a User.find call, which is strange. Do you have anything that might be overriding the default find method?

Try this in the console and see if you get an error.

User.find(:first, :conditions=>{:email=>'email@email.com'})
aNoble
  • 7,033
  • 2
  • 37
  • 33