What would be the best way to use Authlogic in a non-Rails environment? In other words, how to validate credentials from within a Ruby script?
When run from console, self
refers to a "main" Object
, hence Authlogic initialization is pointless:
2.3.1 :009 > Authlogic::Session::Base.controller = Authlogic::ControllerAdapters::RailsAdapter.new(self)
It expects to be initialized with a controller, because it needs request
and ip
and probably other stuff. This is very strange to see, because UserSession
is a model and should not be coupled with a controller.
Any suggestions on how to validate credentials?