erb-to-view-model
ERB → ViewModel: Extract Ruby logic out of an ERB template
When the user types /erb-to-view-model, migrate an ERB template away from instance variables / helper calls by precomputing all required values in a Ruby ViewModel under app/view_models/, following existing repo conventions.
1) Collect required inputs (ask before doing anything)
Before proceeding, ask the user for these parameters (do not proceed until all are provided):
- ERB template path:
<erb-path>(example:app/views/groups/index.html.erb) - Controller + action:
<controller>#<action>(example:GroupsController#index) - Target ViewModel constant:
<view-model-constant>(example:Groups::IndexViewModel) - Target ViewModel file path:
<view-model-path>(example:app/view_models/groups/index_view_model.rb)
This command always uses the template local variable name view_model (it is not configurable).
Also ask for these parameters (strongly recommended; do not proceed without tests):
- Characterization spec path:
<spec-path>(example:spec/controllers/groups_controller_characterization_spec.rb) - Feature flag constraint:
<feature-flag>(example:groups_index_view_model_migration)
More from dailydm/skills
shapeup
ShapeUp: Facilitate the complete ShapeUp workflow with triad collaboration
13hillchart
Hillchart: visualize project progress by analyzing the codebase
5frame
Frame: create a Pitch from a problem statement or idea
4plan
Plan: create an execution Plan from an approved Shaping doc
4shape
Shape: create a filled Shaping doc from an attached Pitch
4implement
Implement: execute a task from a Breakdown
4