Sha256: 156a24a604f0363bfbaf59864400ded186fb80ec840ad4bc99a5a12bd7684fe4
Contents?: true
Size: 888 Bytes
Versions: 6
Compression:
Stored size: 888 Bytes
Contents
require 'generators/rom' module ROM module Generators class CommandsGenerator < Base class_option :adapter, banner: "--adapter=adapter", desc: "specify an adapter to use", required: true, default: default_adapter def create_create_command template 'create.rb.erb', command_file(:create) end def create_update_command template 'update.rb.erb', command_file(:update) end def create_delete_command template 'delete.rb.erb', command_file(:delete) end private def command_file(command) File.join('app', 'commands', "#{command}_#{model_name.downcase}.rb") end def relation class_name.pluralize.underscore end def model_name class_name.singularize end def adapter options[:adapter] end end end end
Version data entries
6 entries across 6 versions & 1 rubygems