Create model template

Hey! I’d like to ask you how to create a model template, similar to helper template. I haven’t found anything related to model templating here, but I’ll be very appreciative for any help.

PS: I’ve tried to create something like this

<% module_namespacing do -%>
class <%= class_name %> < ApplicationRecord
### extends-----------------------------------------------------------------------------------------------------------
### includes----------------------------------------------------------------------------------------------------------
### constants---------------------------------------------------------------------------------------------------------
### class methods-----------------------------------------------------------------------------------------------------
### relationships-----------------------------------------------------------------------------------------------------
### validations-------------------------------------------------------------------------------------------------------
### callbacks (caution: triggers side effects)------------------------------------------------------------------------
### scopes (composable db queries)------------------------------------------------------------------------------------
### additional config (accepts_nested_attribute_for, etc.)------------------------------------------------------------
### public instance methods-------------------------------------------------------------------------------------------
### protected instance methods----------------------------------------------------------------------------------------
### private instance methods------------------------------------------------------------------------------------------
end
<% end -%>

here lib/templates/rails/model/model.rb.tt, but - no success :frowning:

PPS: earlier I wrote an article about custom templates for rails apps, so you’ll help me to improve this guide :slight_smile:

Devise uses a model generator. It might point you in the right direction:

Especially in devise/lib/generators/active_record/devise_generator.rb at main · heartcombo/devise · GitHub

Cheers

As I see - they just invoke active record model generation, then injecting some devise-related code. I’d like to generate using my own template, like helper template I mentioned above or scaffold controller template