diff options
author | Seb Bacon <seb.bacon@gmail.com> | 2012-05-04 10:51:47 +0100 |
---|---|---|
committer | Seb Bacon <seb.bacon@gmail.com> | 2012-05-04 10:51:47 +0100 |
commit | 24caa3143d238412e25752baf4a3af08171853d6 (patch) | |
tree | 8399d8088c9a8c4304285618e6ea1bc8ac9d9519 /app/models/info_request_event.rb | |
parent | 790d8575214e254c1923aa40095171405dbba321 (diff) | |
parent | 20324887036cccc940e1d68fe8c99864b5b634bd (diff) |
Merge branch 'develop' of github.com:sebbacon/alaveteli into develop
Diffstat (limited to 'app/models/info_request_event.rb')
-rw-r--r-- | app/models/info_request_event.rb | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb index 99f34cf9e..cb49596cb 100644 --- a/app/models/info_request_event.rb +++ b/app/models/info_request_event.rb @@ -36,25 +36,29 @@ class InfoRequestEvent < ActiveRecord::Base has_many :track_things_sent_emails validates_presence_of :event_type - validates_inclusion_of :event_type, :in => [ - 'sent', - 'resent', - 'followup_sent', - 'followup_resent', - - 'edit', # title etc. edited (in admin interface) - 'edit_outgoing', # outgoing message edited (in admin interface) - 'edit_comment', # comment edited (in admin interface) - 'destroy_incoming', # deleted an incoming message (in admin interface) - 'destroy_outgoing', # deleted an outgoing message (in admin interface) - 'redeliver_incoming', # redelivered an incoming message elsewhere (in admin interface) - 'move_request', # changed user or public body (in admin interface) - 'manual', # you did something in the db by hand - - 'response', - 'comment', - 'status_update' - ] + + def self.enumerate_event_types + [ + 'sent', + 'resent', + 'followup_sent', + 'followup_resent', + + 'edit', # title etc. edited (in admin interface) + 'edit_outgoing', # outgoing message edited (in admin interface) + 'edit_comment', # comment edited (in admin interface) + 'destroy_incoming', # deleted an incoming message (in admin interface) + 'destroy_outgoing', # deleted an outgoing message (in admin interface) + 'redeliver_incoming', # redelivered an incoming message elsewhere (in admin interface) + 'move_request', # changed user or public body (in admin interface) + 'manual', # you did something in the db by hand + + 'response', + 'comment', + 'status_update', + ] + end + validates_inclusion_of :event_type, :in => enumerate_event_types # user described state (also update in info_request) validate :must_be_valid_state |