Guest

Untitled

By: a guest on Feb 12th, 2012  |  syntax: None  |  size: 0.58 KB  |  hits: 35  |  expires: Never
download  |  raw  |  embed  |  report abuse
Copied
  1. class SessionsController < Devise::SessionsController
  2.  
  3.   private
  4.  
  5.   def format_suffix
  6.     "." + request.format.to_sym.to_s
  7.   end
  8.  
  9.   def stored_location_for(resource_or_scope)
  10.     scope = Devise::Mapping.find_scope!(resource_or_scope)
  11.     session.key?(:"#{scope}_return_to") ? session.delete(:"#{scope}_return_to") + format_suffix : nil
  12.   end
  13.  
  14.   def after_sign_in_path_for(resource_or_scope)
  15.     scope = Devise::Mapping.find_scope!(resource_or_scope)
  16.     home_path = :"#{scope}_root_path"
  17.     respond_to?(home_path, true) ? send(home_path) + format_suffix : root_path + format_suffix
  18.   end
  19.  
  20. end