diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-04-27 15:56:50 +0300 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-05-04 14:54:43 +0300 |
commit | 10aa55a770c2985c22c92d17b8a7ea90b0a09085 (patch) | |
tree | 15b66bb5e3f26d0a49c07bf781c644deb998f0c8 /app/models/user.rb | |
parent | 65bea3f7d0bf30b5f9a9b3f94567474d3c8f7cbc (diff) |
Allow a user to accept/decline terms
When a user accepts, we store this in the agreements to keep track of
which terms they accepted. We also update the flag on the user.
Diffstat (limited to 'app/models/user.rb')
-rw-r--r-- | app/models/user.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index 4a602ffbb05..a9cfd39f604 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -138,6 +138,8 @@ class User < ActiveRecord::Base has_many :custom_attributes, class_name: 'UserCustomAttribute' has_many :callouts, class_name: 'UserCallout' has_many :uploads, as: :model, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent + has_many :term_agreements + belongs_to :accepted_term, class_name: 'ApplicationSetting::Term' # # Validations @@ -1187,6 +1189,10 @@ class User < ActiveRecord::Base max_member_access_for_group_ids([group_id])[group_id] end + def terms_accepted? + accepted_term_id.present? + end + protected # override, from Devise::Validatable |