Class: Devise::InvitationsController
- Inherits:
-
DeviseController
- Object
- DeviseController
- Devise::InvitationsController
- Defined in:
- app/controllers/devise/invitations_controller.rb
Instance Method Summary collapse
-
#create {|resource| ... } ⇒ 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 {|resource| ... } ⇒ Object
PUT /resource/invitation.
Instance Method Details
#create {|resource| ... } ⇒ Object
POST /resource/invitation
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/devise/invitations_controller.rb', line 16 def create self.resource = invite_resource resource_invited = resource.errors.empty? yield resource if block_given? if resource_invited if is_flashing_format? && self.resource.invitation_sent_at :notice, :send_instructions, :email => self.resource.email end respond_with resource, :location => after_invite_path_for(current_inviter) else (resource) { render :new } end end |
#destroy ⇒ Object
GET /resource/invitation/remove?invitation_token=abcdef
61 62 63 64 65 |
# File 'app/controllers/devise/invitations_controller.rb', line 61 def destroy resource.destroy :notice, :invitation_removed if is_flashing_format? redirect_to after_sign_out_path_for(resource_name) end |
#edit ⇒ Object
GET /resource/invitation/accept?invitation_token=abcdef
33 34 35 36 |
# File 'app/controllers/devise/invitations_controller.rb', line 33 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 {|resource| ... } ⇒ Object
PUT /resource/invitation
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'app/controllers/devise/invitations_controller.rb', line 39 def update self.resource = accept_resource invitation_accepted = resource.errors.empty? yield resource if block_given? if invitation_accepted if Devise.allow_insecure_sign_in_after_accept = resource.active_for_authentication? ? :updated : :updated_not_active :notice, if is_flashing_format? sign_in(resource_name, resource) respond_with resource, :location => after_accept_path_for(resource) else :notice, :updated_not_active if is_flashing_format? respond_with resource, :location => new_session_path(resource_name) end else (resource){ render :edit } end end |