Class: RailsJwtAuth::InvitationsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- RailsJwtAuth::InvitationsController
show all
- Includes:
- ParamsHelper, RenderHelper
- Defined in:
- app/controllers/rails_jwt_auth/invitations_controller.rb
Instance Method Summary
collapse
#render_204, #render_422, #render_registration, #render_session
Instance Method Details
#create ⇒ Object
6
7
8
9
10
|
# File 'app/controllers/rails_jwt_auth/invitations_controller.rb', line 6
def create
attr_hash = invitation_create_params
user = RailsJwtAuth.model.invite!(attr_hash)
user.errors.empty? ? render_204 : render_422(user.errors)
end
|
#update ⇒ Object
12
13
14
15
16
17
18
19
20
21
|
# File 'app/controllers/rails_jwt_auth/invitations_controller.rb', line 12
def update
attr_hash = invitation_update_params
user = RailsJwtAuth.model.where(invitation_token: params[:id]).first
user.assign_attributes attr_hash
user.accept_invitation!
return render_204 if user.errors.empty? && user.save
render_422(user.errors)
end
|