diff options
author | azul <azul@riseup.net> | 2014-04-17 10:12:05 +0200 |
---|---|---|
committer | azul <azul@riseup.net> | 2014-04-17 10:12:05 +0200 |
commit | 3513ad74f950b113af1ba1e3d06bc6a55c48fde5 (patch) | |
tree | db49ebd4428053d5c8d720275b77594a531a1ad1 /users/app/models/message.rb | |
parent | cb6442c344d6bdaf52c3878b2de2fcf4d85f2648 (diff) | |
parent | 3d3688647fab7049e5b531c45b85c1e46a1d528f (diff) |
Merge pull request #146 from azul/refactor/engines
Refactor/engines
Diffstat (limited to 'users/app/models/message.rb')
-rw-r--r-- | users/app/models/message.rb | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/users/app/models/message.rb b/users/app/models/message.rb deleted file mode 100644 index 424f094..0000000 --- a/users/app/models/message.rb +++ /dev/null @@ -1,29 +0,0 @@ -class Message < CouchRest::Model::Base - - use_database :messages - - property :text, String - property :user_ids_to_show, [String] - property :user_ids_have_shown, [String] # is this necessary to store? - - timestamps! - - design do - own_path = Pathname.new(File.dirname(__FILE__)) - load_views(own_path.join('..', 'designs', 'message')) - end - - def mark_as_read_by(user) - user_ids_to_show.delete(user.id) - # is it necessary to keep track of what users have already seen it? - user_ids_have_shown << user.id unless read_by?(user) - end - - def read_by?(user) - user_ids_have_shown.include?(user.id) - end - - def unread_by?(user) - user_ids_to_show.include?(user.id) - end -end |