Skip to content

Instantly share code, notes, and snippets.

@movstox
Forked from joshuapinter/irb.rb
Created November 4, 2020 17:37
Show Gist options
  • Save movstox/8bb593443e5729725505e06b7b67bea7 to your computer and use it in GitHub Desktop.
Save movstox/8bb593443e5729725505e06b7b67bea7 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