scambra/devise_invitable — pull request #240 by matchematics (2012-10-09 02:25:06+00:00)
Title: Make after invite / accept path work like Devise Analogs

With Devise proper you can easily customize after_sign_in_path_for, after_sign_out_path_for, etc by overriding the respective method in ApplicationController. With devise_invitable the only way to override after_invite_path_for and after_accept_path_for is to override Devise::InvitationsController. I moved the methods out of the InvitationsController and into the Helpers module which is included in ActionController::Base so these methods can be easily overridden in ApplicationController like the analogous methods in Devise proper. I also added some tests in tests/functional/controller_helpers_test.rb.

If this feature is accepted, users can temporarily patch the current versoin of devise_invitable to respect definitions for after_invite/accept_path_for in ApplicationController by sticking the following in an initializer:

#make invitable's path functions overridable in application controller
[:after_invite_path_for, :after_accept_path_for].each do |method|
Devise::InvitationsController.send(:remove_method, method) if ApplicationController.method_defined? :method
end