diff options
author | Gareth Rees <gareth@mysociety.org> | 2014-10-27 19:24:23 +0000 |
---|---|---|
committer | Gareth Rees <gareth@mysociety.org> | 2014-10-29 13:01:12 +0000 |
commit | ceaefca70bb0c6e5fa139717bc95e9bad3eda43b (patch) | |
tree | 854b525a6b4420b43afe94a0f13722b3d7c3b0b5 | |
parent | daec852cf63bea2091f2ee80c09f28aee91f1f94 (diff) |
Extract UserInfoRequestSentAlert alert types
Extract UserInfoRequestSentAlert alert types to ALERT_TYPES constant.
Useful for tests and forms (access with
UserInfoRequestSentAlert::ALERT_TYPES) and gives more meaning to what
the array contains
-rw-r--r-- | app/models/user_info_request_sent_alert.rb | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/app/models/user_info_request_sent_alert.rb b/app/models/user_info_request_sent_alert.rb index 098b773f8..cd163d14b 100644 --- a/app/models/user_info_request_sent_alert.rb +++ b/app/models/user_info_request_sent_alert.rb @@ -17,18 +17,22 @@ # Email: hello@mysociety.org; WWW: http://www.mysociety.org/ class UserInfoRequestSentAlert < ActiveRecord::Base - belongs_to :user - belongs_to :info_request - - validates_inclusion_of :alert_type, :in => [ + ALERT_TYPES = [ 'overdue_1', # tell user that info request has become overdue 'very_overdue_1', # tell user that info request has become very overdue - 'new_response_reminder_1', # reminder user to classify the recent response - 'new_response_reminder_2', # repeat reminder user to classify the recent response - 'new_response_reminder_3', # repeat reminder user to classify the recent response - 'not_clarified_1', # reminder that user has to explain part of the request - 'comment_1', # tell user that info request has a new comment + 'new_response_reminder_1', # reminder user to classify the recent + # response + 'new_response_reminder_2', # repeat reminder user to classify the + # recent response + 'new_response_reminder_3', # repeat reminder user to classify the + # recent response + 'not_clarified_1', # reminder that user has to explain part of the + # request + 'comment_1' # tell user that info request has a new comment ] -end + belongs_to :user + belongs_to :info_request + validates_inclusion_of :alert_type, :in => ALERT_TYPES +end |