Sha256: cf66a96cb25b3c69fc111c063a74a5554a5bf5af80cefc1dc07772ccc358dade
Contents?: true
Size: 958 Bytes
Versions: 6
Compression:
Stored size: 958 Bytes
Contents
require 'generators/rom' if defined? ROM::Repository module ROM module Generators class RepositoryGenerator < Base class_option :namespace, banner: '--namespace=namespace', desc: "specify a struct namespace for the relation", required: true, default: ::Rails.application.class.name.split("::").first def create_repository_file template( 'repository.rb.erb', File.join('app', 'repositories', "#{repository_name}_repository.rb") ) end private def struct_namespace options[:namespace] end def relation class_name.pluralize.underscore end def model_name class_name.singularize.camelcase end def repository_name class_name.singularize.underscore end def mapper repository_name end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems