See Also: SingleTableInheritance
This article is talking about an issue seeking a solution. This article is work in progress.
There should be a way to specify that a class is table-free, and only the classes implementing that class would be looked up in the database.
Here’s an example that’s also a useful application.
I’m using data from a game database that’s different from my usual website data. I don’t want my website data to be in the same database as the game data, as this might lead to problems with my game server. As a solution, I’m creating a proxy ActiveRecord::Base descendant class called GameData, and all the classes that inherit from GameData would use it’s connection, which would be setup in environments.rb.
in lib/game_data.rb
class GameData < ActiveRecord::Base
end
in config/environment.rb
# Include your application configuration below
GameData.establish_connection "game_#{RAILS_ENV}"
in app/models/character.rb
class Character < GameData
end