Sha256: 7202773c99198b30f70702e44a337be2952af636ef81bbc8aa2919800217b079
Contents?: true
Size: 960 Bytes
Versions: 2
Compression:
Stored size: 960 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rom-rails-1.1.1 | lib/generators/rom/repository_generator.rb |
rom-rails-1.1.0 | lib/generators/rom/repository_generator.rb |