Skip to content

Instantly share code, notes, and snippets.

@spalenza
Forked from joshuapinter/irb.rb
Created July 2, 2019 18:23
Show Gist options
  • Save spalenza/80f1ab3f209a79647bc83ea7f1d17944 to your computer and use it in GitHub Desktop.
Save spalenza/80f1ab3f209a79647bc83ea7f1d17944 to your computer and use it in GitHub Desktop.
Activate Authlogic in Console
if defined?(ActiveRecord::Base) && defined?(Authlogic)
controller = ApplicationController.new
require 'action_controller/test_case'
controller.instance_variable_set(:@_request, ActionController::TestRequest.new)
controller.instance_variable_set(:@_response, ActionController::TestResponse.new)
Authlogic::Session::Base.controller = Authlogic::ControllerAdapters::RailsAdapter.new(controller)
end
UserSession.new( User.first )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment