Sha256: 6b1c5520dc92e8a52a81a2b855934e9c2a9bdecb3aa3fab6128f8682c4cf650c
Contents?: true
Size: 572 Bytes
Versions: 25
Compression:
Stored size: 572 Bytes
Contents
class AddContentStateField < ActiveRecord::Migration class Content < ActiveRecord::Base include BareMigration end def self.up modify_tables_and_update(:add_column, Content, :state, :text) do |content| unless $schema_generator if content.published? content.state = 'Published' elsif content.published_at content.state = 'PublicationPending' else content.state = 'Draft' end end end end def self.down remove_column :contents, :state end end
Version data entries
25 entries across 25 versions & 1 rubygems