Sha256: 9edba57142ca1a7d9a519f7029da529f4007610f691371014d7db50ecceeb7f5

Contents?: true

Size: 370 Bytes

Versions: 7

Compression:

Stored size: 370 Bytes

Contents

class Create<%= model.cp %> < ActiveRecord::Migration
  def self.up
    create_table :<%= model.p %> do |t|
<% model.fields.map do |k, v| %>
  <%= "      t." + v + " :" + k  %>
<% end %>
<% model.foreign_keys.map do |k, v| %>
  <%= "      t.references :" + k[0..-4] %>
<% end %>
      t.timestamps
    end
  end

  def self.down
    drop_table :<%= model.p %>
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mattknox-goaloc-0.2.1 lib/goaloc/generators/rails/migration.rb.erb
mattknox-goaloc-0.2.2 lib/goaloc/generators/rails/migration.rb.erb
mattknox-goaloc-0.2.3 lib/goaloc/generators/rails/migration.rb.erb
mattknox-goaloc-0.2.5 lib/goaloc/generators/rails/migration.rb.erb
mattknox-goaloc-0.2.6 lib/goaloc/generators/rails/migration.rb.erb
mattknox-goaloc-0.2.7 lib/goaloc/generators/rails/migration.rb.erb
mattknox-goaloc-0.2.8 lib/goaloc/generators/rails/migration.rb.erb