I have an application that allows multiple email addresses per user,
each of which works as a login for a single account. As such, the user
table has no login field, but instead has_many :emails, each of which
includes an address field.
I’m using AuthLogic for this, as I’ve had some success with it in the
past. Unfortunately, AuthLogic is not behaving as well in my app as in
I start with:
class UserSession < AuthLogic::Session::Base
(with an appropriate find_by_email(address) function defined in
First, Rails won’t serve the login page:
undefined method `login’ for #<UserSession: no credentials provided>
If I add to user_session.rb a method: def login; @login; end, it
instead complains about password:
undefined method `password’ for #<UserSession: no credentials
I can provide both, and the page loads, but then when I submit (with
ANY value in the fields), I get the following validation error:
1 error prohibited this user session from being saved
There were problems with the following fields:
You did not provide any details for authentication.
My user_sessions_controller.rb is pretty much the default given in the
authlogic example app.
I know it shouldn’t be necessary for me to write in a def login and
def password method in user_session.rb. I gather that I’ve made some
trivial mistake, but have no idea where to look and can find no tips
anywhere in the Googleverse.