'Altering the current outcome of the model of a generated scaffold
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.
Solution 1:[1]
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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Rene van Lieshout |
