Merge pull request #179 from ms32035/master

Added to_i cast fixing String to number comparison error

Andrew Cantino 10 年之前
父節點
當前提交
0a557332f6
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      db/migrate/20131223032112_switch_to_json_serialization.rb

+ 2 - 2
db/migrate/20131223032112_switch_to_json_serialization.rb

@@ -37,8 +37,8 @@ class SwitchToJsonSerialization < ActiveRecord::Migration
37 37
   end
38 38
 
39 39
   def data_exists?
40
-    events = ActiveRecord::Base.connection.select_rows("SELECT count(*) FROM #{ActiveRecord::Base.connection.quote_table_name("events")}").first.first
41
-    agents = ActiveRecord::Base.connection.select_rows("SELECT count(*) FROM #{ActiveRecord::Base.connection.quote_table_name("agents")}").first.first
40
+    events = ActiveRecord::Base.connection.select_rows("SELECT count(*) FROM #{ActiveRecord::Base.connection.quote_table_name("events")}").first.first.to_i
41
+    agents = ActiveRecord::Base.connection.select_rows("SELECT count(*) FROM #{ActiveRecord::Base.connection.quote_table_name("agents")}").first.first.to_i
42 42
     agents + events > 0
43 43
   end
44 44