Class: Operations::FeatureFlagScope
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Operations::FeatureFlagScope
- Includes:
- Gitlab::Utils::StrongMemoize
- Defined in:
- app/models/operations/feature_flag_scope.rb
Class Method Summary collapse
Methods included from Gitlab::Utils::StrongMemoize
#clear_memoization, #strong_memoize, #strong_memoized?
Methods inherited from ApplicationRecord
at_most, id_in, id_not_in, iid_in, pluck_primary_key, primary_key_in, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, underscore, without_order
Class Method Details
.for_unleash_client(project, environment) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'app/models/operations/feature_flag_scope.rb', line 34 def self.for_unleash_client(project, environment) select_columns = [ 'DISTINCT ON (operations_feature_flag_scopes.feature_flag_id) operations_feature_flag_scopes.id', '(operations_feature_flags.active AND operations_feature_flag_scopes.active) AS active', 'operations_feature_flag_scopes.strategies', 'operations_feature_flag_scopes.environment_scope', 'operations_feature_flag_scopes.created_at', 'operations_feature_flag_scopes.updated_at' ] select(select_columns) .with_name_and_description .where(feature_flag_id: project.operations_feature_flags.select(:id)) .order(:feature_flag_id) .on_environment(environment) .reverse_order end |
.with_name_and_description ⇒ Object
29 30 31 32 |
# File 'app/models/operations/feature_flag_scope.rb', line 29 def self.with_name_and_description joins(:feature_flag) .select(FeatureFlag.arel_table[:name], FeatureFlag.arel_table[:description]) end |