File: where-parameters.patch

package info (click to toggle)
ruby-diaspora-vines 0.2.0.develop.4-2
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 1,352 kB
  • ctags: 1,463
  • sloc: ruby: 12,013; makefile: 8
file content (27 lines) | stat: -rw-r--r-- 1,008 bytes parent folder | download
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
27
Description: Compatibility with Rails 4.2.7
 See: https://github.com/rails/rails/issues/20434
Author: Stefano Rivera <stefanor@debian.org>
Forwarded: https://github.com/diaspora/vines/pull/79

--- a/lib/vines/storage/sql.rb
+++ b/lib/vines/storage/sql.rb
@@ -226,7 +226,7 @@
       def save_message(from, to, msg)
         return if from.empty? || to.empty? || msg.empty?
         com = Sql::ChatOfflineMessage
-        current = com.count(:to => to)
+        current = com.where(:to => to).count
         unless current < Config.instance.max_offline_msgs
           com.where(:to => to)
              .order(created_at: :asc)
--- a/test/storage/sql_test.rb
+++ b/test/storage/sql_test.rb
@@ -149,7 +149,7 @@
       Vines::Storage::Sql::ChatOfflineMessage.all.each do |com|
         db.destroy_message(com.id)
       end
-      count = Vines::Storage::Sql::ChatOfflineMessage.count(id: 1)
+      count = Vines::Storage::Sql::ChatOfflineMessage.where(id: 1).count
       assert_equal 0, count
     end
   end