Skip to content

Commit

Permalink
fix for pg
Browse files Browse the repository at this point in the history
  • Loading branch information
Neeraj Singh committed Jun 30, 2011
1 parent d1f266e commit 0b72c44
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/rails_root/test/unit/user_phone_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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
Expand Down

0 comments on commit 0b72c44

Please sign in to comment.