Sha256: 2ab0b4d42f9cc1c080e8b18bb87936774a7289d52645d3cc1032d51b39190596

Contents?: true

Size: 380 Bytes

Versions: 4

Compression:

Stored size: 380 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.to_s + " :" + k.to_s  %>
<% 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

4 entries across 4 versions & 1 rubygems

Version Path
mattknox-goaloc-0.2.10 lib/goaloc/generators/rails/migration.rb.erb
mattknox-goaloc-0.2.11 lib/goaloc/generators/rails/migration.rb.erb
mattknox-goaloc-0.2.9 lib/goaloc/generators/rails/migration.rb.erb
mattknox-goaloc-0.3.0 lib/goaloc/generators/rails/migration.rb.erb