# frozen_string_literal: true require 'rails/generators/named_base' require 'generators/kingsman/orm_helpers' module Mongoid module Generators class KingsmanGenerator < Rails::Generators::NamedBase include Kingsman::Generators::OrmHelpers def generate_model invoke "mongoid:model", [name] unless model_exists? && behavior == :invoke end def inject_field_types inject_into_file model_path, migration_data, after: "include Mongoid::Document\n" if model_exists? end def inject_kingsman_content inject_into_file model_path, model_contents, after: "include Mongoid::Document\n" if model_exists? end def migration_data <