Sha256: 4e42e9591ac90f4303ef1fcc352ea5b907a1a991c7f50316d1376b415ff46086
Contents?: true
Size: 884 Bytes
Versions: 4
Compression:
Stored size: 884 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: ROM.adapters.keys.first 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', file_name, "#{command}.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
4 entries across 4 versions & 1 rubygems