Class: Devise::InvitationsController
- Inherits:
-
DeviseController
- Object
- DeviseController
- Devise::InvitationsController
- Defined in:
- app/controllers/devise/invitations_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /resource/invitation.
-
#destroy ⇒ Object
GET /resource/invitation/remove?invitation_token=abcdef.
-
#edit ⇒ Object
GET /resource/invitation/accept?invitation_token=abcdef.
-
#new ⇒ Object
GET /resource/invitation/new.
-
#update ⇒ Object
PUT /resource/invitation.
Instance Method Details
#create ⇒ Object
POST /resource/invitation
16 17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/devise/invitations_controller.rb', line 16 def create self.resource = invite_resource if resource.errors.empty? :notice, :send_instructions, :email => self.resource.email if self.resource.invitation_sent_at respond_with resource, :location => after_invite_path_for(resource) else (resource) { render :new } end end |
#destroy ⇒ Object
GET /resource/invitation/remove?invitation_token=abcdef
48 49 50 51 52 |
# File 'app/controllers/devise/invitations_controller.rb', line 48 def destroy resource.destroy :notice, :invitation_removed redirect_to after_sign_out_path_for(resource_name) end |
#edit ⇒ Object
GET /resource/invitation/accept?invitation_token=abcdef
28 29 30 31 |
# File 'app/controllers/devise/invitations_controller.rb', line 28 def edit resource.invitation_token = params[:invitation_token] render :edit end |
#new ⇒ Object
GET /resource/invitation/new
10 11 12 13 |
# File 'app/controllers/devise/invitations_controller.rb', line 10 def new self.resource = resource_class.new render :new end |
#update ⇒ Object
PUT /resource/invitation
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/controllers/devise/invitations_controller.rb', line 34 def update self.resource = resource_class.accept_invitation!(update_resource_params) if resource.errors.empty? = resource.active_for_authentication? ? :updated : :updated_not_active :notice, sign_in(resource_name, resource) respond_with resource, :location => after_accept_path_for(resource) else (resource){ render :edit } end end |