app/models/message_request.rb in enju_message-0.1.3 vs app/models/message_request.rb in enju_message-0.1.4

- old
+ new

@@ -1,16 +1,18 @@ require 'erubis' class MessageRequest < ActiveRecord::Base + attr_accessible :body + attr_accessible :sender, :receiver, :message_template, :as => :admin scope :not_sent, where('sent_at IS NULL AND state = ?', 'pending') scope :sent, where(:state => 'sent') scope :started, where(:state => 'started') belongs_to :message_template, :validate => true belongs_to :sender, :class_name => "User", :foreign_key => "sender_id", :validate => true belongs_to :receiver, :class_name => "User", :foreign_key => "receiver_id", :validate => true has_many :messages validates_associated :sender, :receiver, :message_template - validates_presence_of :sender, :receiver, :message_template + validates_presence_of :sender, :receiver, :message_template, :body state_machine :initial => :pending do before_transition any - :sent => :sent, :do => :send_message event :sm_send_message do