Skip to content

Commit

Permalink
Merge pull request #424 from mikz/patch-1
Browse files Browse the repository at this point in the history
Extract accepting invitation to a method
  • Loading branch information
scambra committed Jan 23, 2014
2 parents 74af11d + 4f3c9c7 commit d3441d0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/controllers/devise/invitations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def edit

# PUT /resource/invitation
def update
self.resource = resource_class.accept_invitation!(update_resource_params)
self.resource = accept_resource

if resource.errors.empty?
flash_message = resource.active_for_authentication? ? :updated : :updated_not_active
Expand All @@ -56,6 +56,10 @@ def destroy
def invite_resource
resource_class.invite!(invite_params, current_inviter)
end

def accept_resource
resource_class.accept_invitation!(update_resource_params)
end

def current_inviter
@current_inviter ||= authenticate_inviter!
Expand Down

0 comments on commit d3441d0

Please sign in to comment.