Sha256: 092e0d46712883916ab0370f51d1304b4291b19efaeda430fae1d0cf7e51427f

Contents?: true

Size: 522 Bytes

Versions: 1

Compression:

Stored size: 522 Bytes

Contents

class Change < ActiveRecord::Base; end
class EmbedChangesInReleases < ActiveRecord::Migration
  def up
    add_column :releases, :release_changes, :text
    
    Release.reset_column_information
    
    Release.find_each do |release|
      release.release_changes = Change.where(release_id: release.id).map do |change|
        ReleaseChange.new(release, change.tag_slug, change.description)
      end
      release.save(validate: false)
    end
  end
  
  def down
    remove_column :releases, :release_changes
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
houston-core-0.5.0.beta1 db/migrate/20140425141946_embed_changes_in_releases.rb