README.md in devise_masquerade-0.4.0 vs README.md in devise_masquerade-0.5.0
- old
+ new
@@ -51,31 +51,34 @@
## Custom controller for adding cancan for authorization
class Admin::MasqueradesController < Devise::MasqueradesController
def show
- authorize!(:masquerade, User)
-
super
end
- end
-## Custom url redirect after masquerade:
+ protected
- class Admin::MasqueradesController < Devise::MasqueradesController
- def show
+ def masquerade_authorize!
authorize!(:masquerade, User)
-
- super
end
+ # or you can define:
+ # def masquerade_authorized?
+ # <has access to something?> (true/false)
+ # end
+ end
+
+## Custom url redirect after masquerade:
+
+ class Admin::MasqueradesController < Devise::MasqueradesController
protected
def after_masquerade_path_for(resource)
"/custom_url"
end
end
-
+
#### Dont forget to update your Devise routes to point at your Custom Authorization Controller
in `routes.rb`:
devise_for :users, controllers: { masquerades: "admin/masquerades" }