Sha256: d7096470e808888677f9ca8c8f75a2868a7b421768a95e077b6ee7426c1e982e
Contents?: true
Size: 736 Bytes
Versions: 1
Compression:
Stored size: 736 Bytes
Contents
$files = Dir["#{Rails.root}/db/migrate/tables/*.rb"] $files.each do |file| require file end class MigracionGeneral < ActiveRecord::Migration[5.1] def self.tables general_tables end def self.general_tables @tables = [] $files.each do |file| require file table = "#{file.split("/").last.gsub('.rb','').titleize.delete(' ')}" next if table == 'Base' @tables.push(eval("Tables::#{table}")) end return @tables end def up run_migrations end def down raise ActiveRecord::IrreversibleMigration, 'Error' end private def run_migrations create_tables end def create_tables self.class.tables.each do |table| table.create(self) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
forcast-0.0.110 | lib/forcast/migrations/0_migracion_general.rb |