Class: Orcid::ProfileRequestsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Orcid::ProfileRequestsController
- Defined in:
- app/controllers/orcid/profile_requests_controller.rb
Overview
Responsible for helping a user request a new Orcid Profile.
Instance Attribute Summary collapse
-
#profile_request ⇒ Object
readonly
Returns the value of attribute profile_request.
Instance Method Summary collapse
Instance Attribute Details
#profile_request ⇒ Object (readonly)
Returns the value of attribute profile_request.
7 8 9 |
# File 'app/controllers/orcid/profile_requests_controller.rb', line 7 def profile_request @profile_request end |
Instance Method Details
#create ⇒ Object
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 |
#new ⇒ Object
16 17 18 19 20 21 |
# File 'app/controllers/orcid/profile_requests_controller.rb', line 16 def new 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) respond_with(orcid, new_profile_request) end |
#show ⇒ Object
10 11 12 13 14 |
# File 'app/controllers/orcid/profile_requests_controller.rb', line 10 def show return false if redirecting_because_user_has_connected_orcid_profile return false if redirecting_because_no_profile_request_was_found respond_with(orcid, existing_profile_request) end |