Sha256: 337431f0af2e423f0be4d9374fa5432c165b247cae37b8060d3364233aebfa01
Contents?: true
Size: 503 Bytes
Versions: 1
Compression:
Stored size: 503 Bytes
Contents
class Create<%= plural_name.camelize %> < ActiveRecord::Migration def self.up create_table :<%= plural_name %> do |t| <%- @model_attributes.each do |attr| %> t.<%= attr.migration_field %> :<%= attr.name %> <%- end %> <%- indexed_attributes = @model_attributes.select {|m| m.references?} %> <%- if indexed_attributes.count > 0 %> add_index <%= indexed_attributes.collect {|m| ":" + m.name }.join(', ') %> <%- end %> end end def self.down drop_table :<%= plural_name %> end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mdd-1.1.0 | lib/generators/mdd/scaffold/templates/db_migrate/migrate.rb |