Sha256: 9c68d024b059231133e68f75bed33274b5921c167d115e551e8cfafd444fa7d3

Contents?: true

Size: 1.14 KB

Versions: 4

Compression:

Stored size: 1.14 KB

Contents

class Create<%=parent_plural_class_name%> < ActiveRecord::Migration
  def self.up
    create_table :<%=parent_plural_name%> do |t|
      t.string :title
      t.string :filename
      t.text :desc
      t.boolean :active
      t.string :heading
      t.string :nav
      t.integer :parent_id
      t.integer :lft
      t.integer :rgt
      t.timestamps
    end

    CmsMenuItem.create({:title =>"<%=parent_plural_class_name%>", :controller_name => "<%=parent_plural_name%>", :url => "/<%=parent_plural_name%>"})
    MenuItem.create({:title => "All <%=parent_plural_class_name%>", :url => "/all/<%=parent_plural_name%>", :active => true})

    create_table :<%=child_plural_name%> do |t|
      t.string :title
      t.text :desc
      t.date :date_shot
      t.string :location
      t.integer :<%=parent_singular_name%>_id
      t.string  :file_file_name
      t.string  :file_content_type
      t.integer :file_file_size
      t.datetime :file_updated_at
      t.integer :parent_id
      t.integer :lft
      t.integer :rgt
      t.timestamps
    end

  end

  def self.down
    drop_table :<%=parent_plural_name%>
    drop_table :<%=child_plural_name%>
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dust-generators-0.3.3 lib/generators/dust/albums/templates/migration/albums_migration.rb
dust-generators-0.3.2 lib/generators/dust/albums/templates/migration/albums_migration.rb
dust-generators-0.3.1 lib/generators/dust/albums/templates/migration/albums_migration.rb
dust-generators-0.2.8 lib/generators/dust/albums/templates/migration/albums_migration.rb