Class: ReverseMatchesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- ReverseMatchesController
- Includes:
- ReverseMatchErrors
- Defined in:
- app/controllers/reverse_matches_controller.rb
Instance Method Summary collapse
Instance Method Details
#add_match ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/controllers/reverse_matches_controller.rb', line 5 def add_match begin # NOTE: currently it's only allowed to add matches to published concepts # which are _NOT_ in processing. See older commits how to work with # currently edited concepts matches = @target_match_class.constantize.find_by(concept_id: @published_concept.id, value: @uri) render_response :mapping_exists and return if matches unpublished_concept = @published_concept.branch(@botuser) unpublished_concept.save @target_match_class.constantize.create(concept_id: unpublished_concept.id, value: @uri) unpublished_concept.publish! rescue render_response :server_error and return end render_response :mapping_added end |
#remove_match ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/reverse_matches_controller.rb', line 23 def remove_match begin unpublished_concept = @published_concept.branch(@botuser) unpublished_concept.save match = @target_match_class.constantize.find_by(concept_id: unpublished_concept.id, value: @uri) render_response :unknown_relation and return if match.nil? match.destroy unpublished_concept.publish! rescue render_response :server_error and return end render_response :mapping_removed end |