aboutsummaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/info_request.rb3
-rw-r--r--app/models/outgoing_message.rb23
2 files changed, 25 insertions, 1 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index 21f9e47cb..c354fb3af 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -4,11 +4,12 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: info_request.rb,v 1.3 2007-09-10 01:16:35 francis Exp $
+# $Id: info_request.rb,v 1.4 2007-09-10 18:58:43 francis Exp $
class InfoRequest < ActiveRecord::Base
belongs_to :user
belongs_to :public_body
+ has_many :outgoing_message
# validates_presence_of :user
# validates_numericality_of :user
diff --git a/app/models/outgoing_message.rb b/app/models/outgoing_message.rb
new file mode 100644
index 000000000..186bb2147
--- /dev/null
+++ b/app/models/outgoing_message.rb
@@ -0,0 +1,23 @@
+# models/outgoing_message.rb:
+# A message, associated with a request, from the user of the site to somebody
+# else. e.g. An initial request for information, or a complaint.
+#
+# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
+# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+#
+# $Id: outgoing_message.rb,v 1.1 2007-09-10 18:58:43 francis Exp $
+
+class OutgoingMessage < ActiveRecord::Base
+ belongs_to :info_request
+ validates_presence_of :info_request_id
+
+ validates_presence_of :body
+ validates_inclusion_of :status, :in => ['ready', 'sent', 'failed']
+
+ belongs_to :public_body
+ validates_inclusion_of :message_type, :in => ['initial_request'] #, 'complaint']
+
+ belongs_to :recipient, :polymorphic => true
+
+end
+