Class: Morphing::MorphingController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Morphing::MorphingController
- Defined in:
- app/controllers/morphing/morphing_controller.rb
Instance Method Summary collapse
Instance Method Details
#morph ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'app/controllers/morphing/morphing_controller.rb', line 3 def morph morph_to = User.find(params[:id]) session[:morphed_from] = current_user.id sign_in(:user, morph_to) flash[:success] = "Morphed into #{morph_to.name}" redirect_back_or_to_root end |
#unmorph ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'app/controllers/morphing/morphing_controller.rb', line 12 def unmorph if morph_from = User.find_by_id(session[:morphed_from]) session.delete :morphed_from sign_in :user, morph_from end redirect_back_or_to_root end |