Commit d626d089 by Ivan Lan

Merge branch 'lan/fix_file_loading_bug' into 'master'

Lan/fix file loading bug See merge request !5
parents 8c11eb17 88dfe1bc
......@@ -5,10 +5,10 @@ module WeatherModel
require 'factory_girl_rails'
def self.included base
WeatherModel::SourceSchema.sorts.each { |sort| Object.const_set(sort, Module.new)}
WeatherModel::SourceSchema.constants.each do |source|
settings = SourceSchema.const_get(source)
Object.const_get(settings[:sort]).const_set("#{source.to_s.gsub('_', '::')}", Class.new(Storer::Mysql)).use_settings(settings)
::WeatherModel::SourceSchema.sorts.each { |sort| ::WeatherModel.const_set(sort, Module.new)}
::WeatherModel::SourceSchema.constants.each do |source|
settings = ::WeatherModel::SourceSchema.const_get(source)
::WeatherModel.const_get(settings[:sort]).const_set(source, Class.new(Storer::Mysql)).use_settings(settings)
end
end
......
......@@ -5,9 +5,9 @@ module WeatherModel
[:Forecast, :AutoStation, :Aqi]
end
Dir[File.join(File.dirname(__FILE__), 'source_schemas/*.rb')].each { |file|
require file
}
end
end
Dir['./lib/weather-model/source_schemas/*.rb'].each { |file|
require file
}
\ No newline at end of file
module WeatherModel
module SourceSchema
Forecast =
AqiForecast =
{
sort: 'Aqi',
table_name: :aqi_forecasts,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment