Sha256: d6003bb9be5f8bda9ed6e47701dd45be20c68191ae6da4fedb4b39ff9f4eeb13
Contents?: true
Size: 764 Bytes
Versions: 1
Compression:
Stored size: 764 Bytes
Contents
class AddActsAsUser<%= table_name.camelize %> < ActiveRecord::Migration def self.up change_table(:<%= table_name %>) do |t| t.string :userable_type t.integer :userable_id <% attributes.each do |attribute| -%> t.<%= attribute.type %> :<%= attribute.name %> <% end -%> # Uncomment below if timestamps were not included in your original model. # t.timestamps end add_index :<%= table_name %>, [:userable_id, :userable_type] end def self.down # By default, we don't want to make any assumption about how to roll back a migration when your # model already existed. Please edit below which fields you would like to remove in this migration. raise ActiveRecord::IrreversibleMigration end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
acts_as_user-1.0.0 | lib/generators/active_record/templates/existing_migration.rb |