Module: GroupLinkable

Extended by:
ActiveSupport::Concern
Included in:
Groups::GroupLinks::CreateService, Projects::GroupLinks::CreateService
Defined in:
app/services/concerns/group_linkable.rb

Instance Method Summary collapse

Instance Method Details

#executeObject


6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/services/concerns/group_linkable.rb', line 6

def execute
  return error('Not Found', 404) unless valid_to_create?

  build_link

  if link.save
    after_successful_save
    success(link: link)
  else
    error(link.errors.full_messages.to_sentence, 409)
  end
end