Class: Route
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Route
- Includes:
- CaseSensitivity, Cells::Claimable, EachBatch, Gitlab::SQL::Pattern
- Defined in:
- app/models/route.rb
Constant Summary
Constants included from Cells::Claimable
Cells::Claimable::CLAIMS_BUCKET_TYPE, Cells::Claimable::CLAIMS_SOURCE_TYPE, Cells::Claimable::CLAIMS_SUBJECT_TYPE, Cells::Claimable::MissingPrimaryKeyError
Constants included from Gitlab::SQL::Pattern
Gitlab::SQL::Pattern::MIN_CHARS_FOR_PARTIAL_MATCHING, Gitlab::SQL::Pattern::REGEX_QUOTED_TERM
Constants inherited from ApplicationRecord
Constants included from HasCheckConstraints
HasCheckConstraints::NOT_NULL_CHECK_PATTERN
Constants included from ResetOnColumnErrors
ResetOnColumnErrors::MAX_RESET_PERIOD
Instance Method Summary collapse
- #conflicting_redirects ⇒ Object
- #create_redirect(path) ⇒ Object
- #delete_conflicting_redirects ⇒ Object
- #rename_descendants ⇒ Object
Methods included from Cells::Claimable
Methods included from Gitlab::SQL::Pattern
Methods inherited from ApplicationRecord
===, cached_column_list, #create_or_load_association, current_transaction, declarative_enum, default_select_columns, delete_all_returning, #deleted_from_database?, id_in, id_not_in, iid_in, nullable_column?, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order
Methods included from Organizations::Sharding
Methods included from ResetOnColumnErrors
#reset_on_union_error, #reset_on_unknown_attribute_error
Methods included from Gitlab::SensitiveSerializableHash
Instance Method Details
#conflicting_redirects ⇒ Object
48 49 50 |
# File 'app/models/route.rb', line 48 def conflicting_redirects RedirectRoute.matching_path_and_descendants(path) end |
#create_redirect(path) ⇒ Object
52 53 54 |
# File 'app/models/route.rb', line 52 def create_redirect(path) RedirectRoute.create(source: source, path: path) end |
#delete_conflicting_redirects ⇒ Object
44 45 46 |
# File 'app/models/route.rb', line 44 def delete_conflicting_redirects conflicting_redirects.delete_all end |
#rename_descendants ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'app/models/route.rb', line 33 def rename_descendants return unless saved_change_to_path? || saved_change_to_name? changes = { path: { saved: saved_change_to_path?, old_value: path_before_last_save }, name: { saved: saved_change_to_name?, old_value: name_before_last_save } } Routes::RenameDescendantsService.new(self).execute(changes) # rubocop: disable CodeReuse/ServiceClass -- Need a service class to encapsulate all the logic. end |