diff options
author | Seb Bacon <seb.bacon@gmail.com> | 2012-05-16 12:18:14 +0100 |
---|---|---|
committer | Seb Bacon <seb.bacon@gmail.com> | 2012-05-16 12:18:14 +0100 |
commit | 447627d647fd28062bd1cb2d4bc4ee8d56fb2323 (patch) | |
tree | a6304d83f7bd7b192d0da46efc7c2dfe947f9098 | |
parent | f9fc1fd6509bc89394ff0735ab4efc46492f7bd3 (diff) |
Rollback refactoring of event_type validation that broke various tests
-rw-r--r-- | app/models/info_request_event.rb | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb index c5ca5fedd..dacd3223e 100644 --- a/app/models/info_request_event.rb +++ b/app/models/info_request_event.rb @@ -36,25 +36,30 @@ 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 |