Class: Cubic::Generator::Migrations

Inherits:
Base
  • Object
show all
Defined in:
lib/cubic/generators/migrations.rb

Overview

Generates the migrations for columns and rows attached to a model.

Instance Attribute Summary

Attributes inherited from Base

#files

Instance Method Summary collapse

Methods inherited from Base

#callback, #generate, #initialize

Constructor Details

This class inherits a constructor from Cubic::Generator::Base

Instance Method Details

#design(name, options) ⇒ Object

Creates a hash that will be used for file generation purposes



7
8
9
10
11
12
13
14
# File 'lib/cubic/generators/migrations.rb', line 7

def design(name, options)
  @files << { name: "create_#{name}.rb",
              path: '/db/migrations/',
              content: "DB.create_table :#{name.to_s.concat('s')} do
                primary_key :id
                #{pair(options)}
              end" }
end