Problem with set_table_name


#1

Dear friends,
I ran the following in my console.Assume I already have the
postgresql connection .

class D < ActiveRecord::Base
end
=> nil

D.set_table_name “users”
=> nil

D.column_names
=> [“id”, “name”, “fname”, “lname”, “password”, “addr1”, “addr2”,
“city”, “state”, “email”, “created”, “gender”]

D.reset_table_name
=> “ds”

D.set_table_name “orders”
=> nil

D.column_names
=> [“id”, “name”, “fname”, “lname”, “password”, “addr1”, “addr2”,
“city”, “state”, “email”, “created”, “gender”]

D.table_name
=> “orders”

Though I have different columns in “orders” table ,I get the same
column_names for “orders” table .

Please help me.

Regards,
Sarathy


#2

On 25 Feb 2009, at 13:22, Sarathy .n wrote:

D.table_name
=> “orders”

Though I have different columns in “orders” table ,I get the same
column_names for “orders” table .

ActiveRecord caches the column information - you should probably call
reset_column_information after changing the table name

Fred