Class: ApplicationSetting::Term

Inherits:
ApplicationRecord show all
Includes:
CacheMarkdownField
Defined in:
app/models/application_setting/term.rb

Constant Summary

Constants included from CacheMarkdownField

CacheMarkdownField::INVALIDATED_BY

Constants inherited from ApplicationRecord

ApplicationRecord::MAX_PLUCK

Constants included from ResetOnUnionError

ResetOnUnionError::MAX_RESET_PERIOD

Instance Attribute Summary

Attributes included from CacheMarkdownField

#skip_markdown_cache_validation

Class Method Summary collapse

Instance Method Summary collapse

Methods included from CacheMarkdownField

#attribute_invalidated?, #banzai_render_context, #cached_html_for, #cached_html_up_to_date?, #can_cache_field?, #invalidated_markdown_cache?, #latest_cached_markdown_version, #local_version, #mentionable_attributes_changed?, #mentioned_filtered_user_ids_for, #parent_user, #refresh_markdown_cache, #refresh_markdown_cache!, #rendered_field_content, #skip_project_check?, #store_mentions!, #updated_cached_html_for

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

Class Method Details

.latestObject



13
14
15
# File 'app/models/application_setting/term.rb', line 13

def self.latest
  order(:id).last
end

Instance Method Details

#accepted_by_user?(user) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
20
21
22
# File 'app/models/application_setting/term.rb', line 17

def accepted_by_user?(user)
  return true if user.project_bot?

  user.accepted_term_id == id ||
    term_agreements.accepted.where(user: user).exists?
end