Sha256: e3ae11f5794707f6e23989a6e42e07c2ec30516b64567885de40e1185f502262

Contents?: true

Size: 529 Bytes

Versions: 3

Compression:

Stored size: 529 Bytes

Contents

class Add<%= permalink_field_name.camelize %>To<%= permalink_table_name.capitalize %> < ActiveRecord::Migration
  def self.up
    add_column :<%= permalink_table_name %>, :<%= permalink_field_name %>, :string, :default => nil

    <%= permalink_table_name.classify %>.reset_column_information
    <%= permalink_table_name.classify %>.all.each do |obj|
      obj.<%= permalink_field_name %> = nil
      obj.save
    end
  end

  def self.down
    remove_column :<%= permalink_table_name %>, :<%= permalink_field_name %>
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
chinese_permalink-1.1.2 generators/chinese_permalink_migration/templates/migration.rb
chinese_permalink-1.1.1 generators/chinese_permalink_migration/templates/migration.rb
chinese_permalink-1.1.0 generators/chinese_permalink_migration/templates/migration.rb