Class: Devise::InvitationsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Devise::InvitationsController
- Includes:
- Controllers::InternalHelpers
- Defined in:
- app/controllers/devise/invitations_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /resource/invitation.
-
#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 = resource_class.invite!(params[resource_name], current_inviter) if resource.errors.empty? :notice, :send_instructions, :email => self.resource.email respond_with resource, :location => after_invite_path_for(resource) else (resource) { render_with_scope :new } end end |
#edit ⇒ Object
GET /resource/invitation/accept?invitation_token=abcdef
28 29 30 31 32 33 34 35 |
# File 'app/controllers/devise/invitations_controller.rb', line 28 def edit if params[:invitation_token] && self.resource = resource_class.first(:conditions => { :invitation_token => params[:invitation_token] }) render_with_scope :edit else (:alert, :invitation_token_invalid) redirect_to after_sign_out_path_for(resource_name) end end |
#new ⇒ Object
GET /resource/invitation/new
10 11 12 13 |
# File 'app/controllers/devise/invitations_controller.rb', line 10 def new build_resource render_with_scope :new end |
#update ⇒ Object
PUT /resource/invitation
38 39 40 41 42 43 44 45 46 47 48 |
# File 'app/controllers/devise/invitations_controller.rb', line 38 def update self.resource = resource_class.accept_invitation!(params[resource_name]) if resource.errors.empty? :notice, :updated sign_in(resource_name, resource) respond_with resource, :location => after_accept_path_for(resource) else (resource){ render_with_scope :edit } end end |