Hi …
We are constructing at rails GUI using two differant databases, and this
seems to work out nicely using a “establish_connection” per model, where
each model enherit directly from ActiveRecord::Base.
But ! I like to use a model where we can inherit from one parent class
that handles the connection exactly as descripted in this document :
http://blogs.pragprog.com/cgi-bin/pragdave.cgi/Tech/Ruby/Connections.rdoc
The only problem is that my database (postgres) seems to be asked to
find this parent class, but this should not have happend !
My Models looks like this :
– app/models/safe_record.rb
class SafeRecord < ActiveRecord::Base
establish_connection “safe_#{RAILS_ENV}”
end
– app/models/event.rb
class Event < SafeRecord
end
– Taken from script/console when doing a “e = Event.new”
ActiveRecord::StatementInvalid: PGError: ERROR: relation “safe_record”
does not exist
Why are rails looking for “safe_record” ?
/BL