Method: Orcid::ProfileRequestsController#create

Defined in:
app/controllers/orcid/profile_requests_controller.rb

#createObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'app/controllers/orcid/profile_requests_controller.rb', line 23

def create
  return false if redirecting_because_user_has_connected_orcid_profile
  return false if redirecting_because_user_has_existing_profile_request
  assign_attributes(new_profile_request)
  create_profile_request(new_profile_request)
  # As a named singular resource, url_for(profile_request) treates the
  # input profile_request as the :format paramter. When you run
  # `$ rake app:routes` in this gem, there is not a named route for:
  # GET  /profile_request(.:format)         orcid/profile_requests#show
  #
  # Thus we need to pass the location.
  if new_profile_request.valid?
    respond_with(orcid, location: orcid.profile_request_path)
  else
    respond_with(orcid, new_profile_request)
  end
end