Sha256: e42871ac471b98b0ba0ace7be15e2b752c57704ca3e09a5e61a98eb84d60b088

Contents?: true

Size: 1.04 KB

Versions: 41

Compression:

Stored size: 1.04 KB

Contents

class CreateSettings < ActiveRecord::Migration
  
  def self.up
    create_table :settings do |t|
      t.string :site_name
      t.string :site_tagline
      t.boolean :enable_comments_in_pages, default: false
      t.boolean :disable_blog, default: false
      t.string :blog_name
      t.string :blog_tagline
      t.boolean :enable_comments_in_blog, default: true
      t.timestamps
    end
    Setting.create_translation_table! :site_name => :string, :site_tagline => :string, :blog_name => :string, :blog_tagline => :string
    # normally it's not a good idea to populate a table in the migration but I think this is an exception
    Setting.create([
      { site_name: 'Name of the web site',
        site_tagline: 'A short descriptive sentence',
        enable_comments_in_pages: false,
        disable_blog: false,
        blog_name: 'Name of the blog',
        blog_tagline: "A short descriptive sentence",
        enable_comments_in_blog: true
      }
    ])
  end
  
  def self.down
    drop_table :settings
    Setting.drop_translation_table!
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
tkh_admin_panel-0.9.25 lib/generators/tkh_admin_panel/create_or_update_migrations/templates/create_settings.rb
tkh_admin_panel-0.9.24 lib/generators/tkh_admin_panel/create_or_update_migrations/templates/create_settings.rb
tkh_admin_panel-0.9.23 lib/generators/tkh_admin_panel/create_or_update_migrations/templates/create_settings.rb
tkh_admin_panel-0.9.22 lib/generators/tkh_admin_panel/create_or_update_migrations/templates/create_settings.rb
tkh_admin_panel-0.9.21 lib/generators/tkh_admin_panel/create_or_update_migrations/templates/create_settings.rb
tkh_admin_panel-0.9.20 lib/generators/tkh_admin_panel/create_or_update_migrations/templates/create_settings.rb
tkh_admin_panel-0.9.19 lib/generators/tkh_admin_panel/create_or_update_migrations/templates/create_settings.rb
tkh_admin_panel-0.9.18 lib/generators/tkh_admin_panel/create_or_update_migrations/templates/create_settings.rb
tkh_admin_panel-0.9.17 lib/generators/tkh_admin_panel/create_or_update_migrations/templates/create_settings.rb
tkh_admin_panel-0.9.16 lib/generators/tkh_admin_panel/create_or_update_migrations/templates/create_settings.rb
tkh_admin_panel-0.9.15 lib/generators/tkh_admin_panel/create_or_update_migrations/templates/create_settings.rb
tkh_admin_panel-0.9.14 lib/generators/tkh_admin_panel/create_or_update_migrations/templates/create_settings.rb
tkh_admin_panel-0.9.13 lib/generators/tkh_admin_panel/create_or_update_migrations/templates/create_settings.rb
tkh_admin_panel-0.9.12 lib/generators/tkh_admin_panel/create_or_update_migrations/templates/create_settings.rb
tkh_admin_panel-0.9.11 lib/generators/tkh_admin_panel/create_or_update_migrations/templates/create_settings.rb
tkh_admin_panel-0.9.10 lib/generators/tkh_admin_panel/create_or_update_migrations/templates/create_settings.rb
tkh_admin_panel-0.9.9 lib/generators/tkh_admin_panel/create_or_update_migrations/templates/create_settings.rb
tkh_admin_panel-0.9.8 lib/generators/tkh_admin_panel/create_or_update_migrations/templates/create_settings.rb
tkh_admin_panel-0.9.7 lib/generators/tkh_admin_panel/create_or_update_migrations/templates/create_settings.rb
tkh_admin_panel-0.9.6 lib/generators/tkh_admin_panel/create_or_update_migrations/templates/create_settings.rb