Sha256: 7e3039e3ad2621dd73420f981707dd561cbe93304a202c70d8f6c1e02b23f735

Contents?: true

Size: 766 Bytes

Versions: 7

Compression:

Stored size: 766 Bytes

Contents

class AddActsAsUserTo<%= 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

7 entries across 7 versions & 1 rubygems

Version Path
acts_as_user-1.2.6 lib/generators/active_record/templates/existing_migration.rb
acts_as_user-1.2.5 lib/generators/active_record/templates/existing_migration.rb
acts_as_user-1.2.4 lib/generators/active_record/templates/existing_migration.rb
acts_as_user-1.2.3 lib/generators/active_record/templates/existing_migration.rb
acts_as_user-1.2.2 lib/generators/active_record/templates/existing_migration.rb
acts_as_user-1.2.1 lib/generators/active_record/templates/existing_migration.rb
acts_as_user-1.0.1 lib/generators/active_record/templates/existing_migration.rb