Habtm in a standalone ruby script broken?


i have a ruby script which uses the activerecord models of my rails
application. this is achieved with
$LOAD_PATH << ‘…/availdb/app/models’
require ‘rubygems’
require_gem ‘activerecord’
require ‘host_downtime’
require ‘host_scheduled_downtime’

And in …/app/models/host_downtime.rb:
class HostDowntime < ActiveRecord::Base
has_and_belongs_to_many :host_scheduled_downtimes

And in …/app/models/host_scheduled_downtime.rb:
class HostScheduledDowntime < ActiveRecord::Base
has_and_belongs_to_many :host_downtimes

this works fine, until i introduce a table_prefix with
ActiveRecord::Base.table_name_prefix = “devel_”

From the database log i see that each tablename is correctly prefixed
with _devel, execept the join_table
I included a printf stament in Associations::join_table_name and saw
that table_name_prefix was an empty string.
If i comment out the require statements and write the class definitions
directly in the standalone ruby script, it works perfectly. So does the
rails application.

May i beg for help?

Greetings from Munich,