app/models/message_request.rb in enju_message-0.4.0.beta.1 vs app/models/message_request.rb in enju_message-0.4.0.beta.2
- old
+ new
@@ -1,6 +1,9 @@
class MessageRequest < ApplicationRecord
- include Statesman::Adapters::ActiveRecordQueries
+ include Statesman::Adapters::ActiveRecordQueries[
+ transition_class: MessageRequestTransition,
+ initial_state: :pending
+ ]
scope :not_sent, -> {in_state(:pending).where('sent_at IS NULL')}
scope :sent, -> {in_state(:sent)}
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