blob: 51ca46c661f87b9bbddf0cca6a19f718cc18f4e4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# TODO WOULD NOT USE anymore, in proposed alternate, so delete file.
class XXXXUserMessage < CouchRest::Model::Base
use_database :user_messages
belongs_to :user
belongs_to :message
validates :user_id, presence: true
validates :message_id, presence: true
# should not have multiple rows connecting one user to particular message:
validates_uniqueness_of :user_id, :scope => [:message_id]
property :seen, TrueClass, :default => false
design do
view :by_user_id
view :by_message_id
view :by_user_id_and_seen
view :by_user_id_and_message_id
own_path = Pathname.new(File.dirname(__FILE__))
load_views(own_path.join('..', 'designs', 'user_message'))
end
end
|