Class: Ci::Catalog::Resource

Inherits:
ApplicationRecord show all
Defined in:
app/models/ci/catalog/resource.rb

Overview

This class represents a CI/CD Catalog resource. A Catalog resource is normally associated to a project. This model connects to the ‘main` database because of its dependency on the Project model and its need to join with that table in order to generate the CI/CD catalog.

Constant Summary

Constants inherited from ApplicationRecord

ApplicationRecord::MAX_PLUCK

Constants included from ResetOnUnionError

ResetOnUnionError::MAX_RESET_PERIOD

Instance Method Summary collapse

Methods inherited from ApplicationRecord

cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, pluck_primary_key, 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 SensitiveSerializableHash

#serializable_hash

Instance Method Details

#latest_versionObject



30
31
32
# File 'app/models/ci/catalog/resource.rb', line 30

def latest_version
  project.releases.latest
end

#versionsObject



26
27
28
# File 'app/models/ci/catalog/resource.rb', line 26

def versions
  project.releases.order_released_desc
end