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

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, #parent_user, #refresh_markdown_cache, #refresh_markdown_cache!, #rendered_field_content, #skip_project_check?, #updated_cached_html_for

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

.latestObject


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

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

Instance Method Details

#accepted_by_user?(user) ⇒ Boolean

Returns:

  • (Boolean)

16
17
18
19
# File 'app/models/application_setting/term.rb', line 16

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