Sha256: 738196f89222c7288f27e71441728e069ba9b910ed6bda5a7b0c4ddd61b0d1f3
Contents?: true
Size: 817 Bytes
Versions: 36
Compression:
Stored size: 817 Bytes
Contents
# frozen_string_literal: true require 'rails/generators' require 'rails/generators/model_helpers' class Valkyrie::ResourceGenerator < Rails::Generators::NamedBase # Include ModelHelpers to warn about pluralization when generating new models or scaffolds include Rails::Generators::ModelHelpers source_root File.expand_path('../templates', __FILE__) argument :attributes, type: :array, default: [], banner: 'field:type field:type' def create_model template('resource.rb.erb', File.join('app/models', class_path, "#{file_name}.rb")) end def create_model_spec return unless rspec_installed? template('resource_spec.rb.erb', File.join('spec/models', class_path, "#{file_name}_spec.rb")) end private def rspec_installed? defined?(RSpec) && defined?(RSpec::Rails) end end
Version data entries
36 entries across 36 versions & 1 rubygems