Class: RubyUiScaffold::Generators::RubyUiScaffoldGenerator
- Inherits:
-
Rails::Generators::ScaffoldGenerator
- Object
- Rails::Generators::ScaffoldGenerator
- RubyUiScaffold::Generators::RubyUiScaffoldGenerator
- Defined in:
- lib/generators/ruby_ui_scaffold/ruby_ui_scaffold_generator.rb
Overview
Entry point: ‘rails g ruby_ui_scaffold User name:string …`
Inherits the full scaffold pipeline from Rails (model, migration, resource route, tests, helper), but redirects the scaffold_controller hook to our subclass — which in turn redirects the template_engine hook to our Phlex views generator.
Instance Method Summary collapse
-
#_invoke_from_option_orm ⇒ Object
Command for the inherited ‘:orm` hook (model + migration + model test + fixtures).
-
#initialize(args, local_options = {}, config = {}) ⇒ RubyUiScaffoldGenerator
constructor
–skip-model implies –force: a re-run otherwise aborts on the controller’s class-collision check (the controller already exists), and the intent is to overwrite the regenerated controller/views.
Constructor Details
#initialize(args, local_options = {}, config = {}) ⇒ RubyUiScaffoldGenerator
–skip-model implies –force: a re-run otherwise aborts on the controller’s class-collision check (the controller already exists), and the intent is to overwrite the regenerated controller/views. We inject “–force” into the RAW options before Thor parses them — not by mutating ‘options` afterward — because the controller/views sub-generators are invoked by re-parsing the original init options stored in Thor’s ‘@_initializer` (see Thor::Invocation#_parse_initialization_options). A post-parse mutation of `options` never reaches them; a real flag does.
81 82 83 84 |
# File 'lib/generators/ruby_ui_scaffold/ruby_ui_scaffold_generator.rb', line 81 def initialize(args, = {}, config = {}) = imply_force() if skip_model_requested?() super end |
Instance Method Details
#_invoke_from_option_orm ⇒ Object
Command for the inherited ‘:orm` hook (model + migration + model test + fixtures). Thor generates it as `_invoke_from_option_orm`; we override it to no-op under –skip-model while leaving `options` intact, so orm helpers and option propagation to the controller are unaffected.
90 91 92 93 94 |
# File 'lib/generators/ruby_ui_scaffold/ruby_ui_scaffold_generator.rb', line 90 def _invoke_from_option_orm return if [:skip_model] super end |