Permalink
Browse files

fix for pg

  • Loading branch information...
1 parent d1f266e commit 0b72c44a3706591572d6e3b18b1bb94b723e450c Neeraj Singh committed Jun 30, 2011
Showing with 3 additions and 2 deletions.
  1. +3 −2 test/rails_root/test/unit/user_phone_test.rb
@@ -10,10 +10,11 @@ def setup
def count_of_main_klass_records_not_in_hm_klass(main_klass, hm_klass, hm_relationship_name)
foreign_key = main_klass.reflections[hm_relationship_name].instance_variable_get('@active_record').name.foreign_key
+ raise 'foreign_key is nil' unless foreign_key
sql = %Q{
- select count(*)
+ select count(*) as count_data
from #{main_klass.table_name}
where users.id NOT IN (
select #{hm_klass.table_name}.#{foreign_key}
@@ -22,7 +23,7 @@ def count_of_main_klass_records_not_in_hm_klass(main_klass, hm_klass, hm_relatio
}
record = main_klass.find_by_sql(sql).first
- record['count(*)']
+ record['count_data'].to_i
end
def test_pie_chart_for_user_with_phones_vs_users_without_phones

0 comments on commit 0b72c44

Please sign in to comment.