I have a rails 2.3.8 application which I migrated to rails 3.0.10 However after migration, I could see issues using default_scope in the models. I am baffled why it is coming , though everything worked fine previously .I am using pg 0.11 gem . In the development logs I could see , while loading the model table ,it is trying to do order by name instead of order by rel_name in the pg_class table . Earlier before the upgrade , the same piece of code works fine.
TestGroup::PgClass Load (1.1ms) SELECT "pg_class".* FROM "pg_class" WHERE "pg_class"."relname" = 'test_groups' ORDER BY UPPER(name) ASC, relname LIMIT 1 PGError: ERROR: column "name" does not exist
class TestGroup < ActiveRecord::Base
default_scope :order => "UPPER(name) ASC"
<other piece of code...>
end
This is driving me nuts . I tried changing the default_scope code in the model but that doesn't helped out . order("UPPER(#table_name}.name) ASC")
Any help is much appreciated .Is there any issue how rails and pg gem interact with each other ?