lib/rails/generators/mongoid/model/model_generator.rb in mongoid-8.1.7 vs lib/rails/generators/mongoid/model/model_generator.rb in mongoid-9.0.0

- old
+ new

@@ -1,11 +1,14 @@ # frozen_string_literal: true +# rubocop:todo all require "rails/generators/mongoid_generator" module Mongoid module Generators + + # Generator class for Mongoid model files. class ModelGenerator < Base desc "Creates a Mongoid model" argument :attributes, type: :array, default: [], banner: "field:type field:type" @@ -13,9 +16,10 @@ class_option :timestamps, type: :boolean, default: true class_option :parent, type: :string, desc: "The parent class for the generated model" class_option :collection, type: :string, desc: "The collection for storing model's documents" + # Creates a model file from a template. def create_model_file template "model.rb.tt", File.join("app/models", class_path, "#{file_name}.rb") end hook_for :test_framework