I'm spidering historical weather data from various sources. I have a WeatherStation class that is begging for an STI implementation: a WeatherStation is associated with a specific weather service, and each weather service has its own protocol for fetching weather data, but most of the code is can be shared in the WeatherStation parent class. Ergo STI.
But there are a lot of weather services, so I'd like to gather all the subclasses into a subdirectory (that's aka namespace, right?).
The table will be something like:
create_table :weather_stations do |t} t.string :callsign t.string :type # for STI t.timestamp attempted_at # be nice to webmasters t.timestamp succeeded_at end
... and my directory structure is:
apps/models/WeatherStation.rb apps/models/weather_stations/noaa.rb apps/models/weather_stations/cwop.rb apps/models/weather_stations/wolfram.rb
... etc.
So: are there any special considerations in this approach? The docs talk about namespacing models, and talk (briefly) about STI, but not together. Do I have to do anything special with table_name_prefix or descends_from_active_record? ?
I'll set about trying this out as soon as I hit [submit], but I'd appreciate a heads up if I'm headed for trouble!
TIA.
- ff