Sha256: 92f4f6deeff52c4573cc095b7c809c3993ed115b9147a85a389e065bf9528d6c
Contents?: true
Size: 325 Bytes
Versions: 6
Compression:
Stored size: 325 Bytes
Contents
class AddBlogIdToTags < ActiveRecord::Migration class Tag < ActiveRecord::Base; end def up add_column :tags, :blog_id, :integer if Tag.any? default_blog_id = Blog.order(:id).first.id Tag.update_all("blog_id = #{default_blog_id}") end end def down remove_column :tags, :blog_id end end
Version data entries
6 entries across 6 versions & 1 rubygems