set_table_name on RoR 1.2.4

Unfortunately I had to work on some proprietary MSSQL database building some internal web application. Naturally, I use RoR 1.2.4. Even I add set_table_name and set_primary_key in Model (RegionalIndex) of mine it have made SQL requests using regional_indexes as a table name. After spending some time I come with the solution witch puzzled me a bit.

The model is looks as follows: class Regionalindex < ActiveRecord::Base   set_table_name "RegionalIndex"   set_primary_key "IndexID" end

and it not works as expected.

When I change it to class Regionalindex < ActiveRecord::Base   ActiveRecord::Base.set_table_name "RegionalIndex"   ActiveRecord::Base.set_primary_key "IndexID" End

everything is performing OK.

Do you think it's a little puzzling?

Puzzling, and scary.

It would look like this would set the table name and primary key for ALL models. Actually it appears to set it for subsequent subclasses, including the one currently being defined if, as you have it, it's in the context of a class definition. Here's an experiment using rails from svn:

$ script/console Loading development environment (Rails 1.2.4)