Class: Flatfish::CreateKlass
- Inherits:
-
ActiveRecord::Migration
- Object
- ActiveRecord::Migration
- Flatfish::CreateKlass
- Defined in:
- lib/flatfish/create_tables.rb
Class Method Summary collapse
-
.setup(schema, klass) ⇒ Object
assume every klass has a URL, Path, Title pass in additional columns from CSV.
Class Method Details
.setup(schema, klass) ⇒ Object
assume every klass has a URL, Path, Title pass in additional columns from CSV
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/flatfish/create_tables.rb', line 6 def self.setup(schema, klass) k = klass.tableize.to_sym create_table(k) do |t| t.string :url t.string :path t.string :title end schema.each do |column| add_column(k, column.gsub(/\s+/, '_').downcase.to_sym, :text) end end |