Hi all
I’m developing a plugin that looks like this so far:
module ActsAsAuthenticated
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def acts_as_authenticated(options = {})
options = {
:uid => :name
}.merge(options)
include(InstanceMethods)
def authenticate(name, password)
user = send("find_by_#{options[:uid]}".to_sym, name)
if user
if user.hashed_password != encrypted_password(password,
user.password_salt)
user = nil
end
end
user
end
end
end
end
The important line is
user = send(“find_by_#{options[:uid]}”.to_sym, name)
because I want the user of my plugin to be able to pass an optional
option[:uid] to the plugin. But sadly, I get the following error:
undefined local variable or method `options’ for Member:Class
Why that? How can I achieve what I want?
Thanks
Josh