class Pliny::Commands::Generator::Model

Public Instance Methods

create() click to toggle source
# File lib/pliny/commands/generator/model.rb, line 6
def create
  model = "./lib/models/#{field_name}.rb"
  write_template('model.erb', model,
                  singular_class_name: singular_class_name,
                  paranoid: options[:paranoid])
  display "created model file #{model}"
end
create_migration() click to toggle source
# File lib/pliny/commands/generator/model.rb, line 14
def create_migration
  migration = "./db/migrate/#{Time.now.to_i}_create_#{table_name}.rb"
  write_template('model_migration.erb', migration,
                  table_name: table_name,
                  paranoid: options[:paranoid])
  display "created migration #{migration}"
end
create_test() click to toggle source
# File lib/pliny/commands/generator/model.rb, line 22
def create_test
  test = "./spec/models/#{field_name}_spec.rb"
  write_template('model_test.erb', test,
                  singular_class_name: singular_class_name)
  display "created test #{test}"
end