AzuCLI::Generate::Model
Inherits Teeplate::FileTree < Reference < Object
Model generator that creates CQL::ActiveRecord::Model classes
Constants
OUTPUT_DIR = "./src/models"
Constructors
new(name : String, attributes : Hash(String, String), timestamps : Bool = true, database : String = "AppDB", id_type : String = "Int64", generate_migration : Bool = true)
SourceInstance methods
__ecr1(____io)
Sourceassociations
Sourceassociations=(associations : Hash(String, String))
Sourceattributes
Sourceattributes=(attributes : Hash(String, String))
Sourcedatabase
Sourcedatabase=(database : String)
Sourcefields
Sourcefields=(fields : Hash(String, String))
Sourcegenerate_migration
Sourcegenerate_migration=(generate_migration : Bool)
Sourceid_type
Sourceid_type=(id_type : String)
Sourcemigration_field_options(attr_type : String, field : String) : String
Get migration field options
render(output_path : String, force : Bool = false, interactive : Bool = true, list : Bool = false, color : Bool = false)
In the render method or after model file generation, if generate_migration is true, generate migration (Assume migration generator is available as AzuCLI::Generate::Migration)
resource_plural
Sourceresource_plural=(resource_plural : String)
Sourcescopes
Sourcescopes=(scopes : Array(String))
Sourceshould_add_index?(attr_type : String, field : String) : Bool
Check if field should have an index
snake_case_name=(snake_case_name : String)
Sourcetimestamps
Sourcetimestamps=(timestamps : Bool)
Sourcevalidations
Sourcevalidations=(validations : Hash(String, Array(String)))
Source