Reputation: 13
I aim to make some turbo additions to the current scaffold generator. For that i need the plural_model_name in the model. I am looking for a way to alter the output model, generated by the rails g scaffold
command.
class <%= singular_model_name %> < ApplicationRecord
broadcasts to: <%= plural_model_name %>
end
Can anyone give me a nudge in the right direction?, I would also be very thankful if some instructions can be given as to in which folder in /lib/
i am supposed to place the monkey-patched version.
I have been going through nearly all generators here but i cannot seem to get a grasp of where the model is taken care of.
Contrary to the model i have successfully been able to alter the view templates, view generator, and controller template and ScaffoldControllerGenerator for the scaffold generator.
Upvotes: 1
Views: 29
Reputation: 372
You should be able to add it there
Second, configure your options in https://github.com/rails/rails/blob/f95c0b7e96eb36bc3efc0c5beffbb9e84ea664e4/activerecord/lib/rails/generators/active_record/model/model_generator.rb
Upvotes: 0