Skip to content

Instantly share code, notes, and snippets.

@ErinClaudio
Last active June 27, 2024 13:41
Show Gist options
  • Save ErinClaudio/b43b9dc0906faba2f1be742576726825 to your computer and use it in GitHub Desktop.
Save ErinClaudio/b43b9dc0906faba2f1be742576726825 to your computer and use it in GitHub Desktop.

Issue #834 on GitHub

Task List for Renaming DefaultPetTask to Checklist::TaskTemplate

(https://gist.github.com/ErinClaudio/aece2132cf3764fa8ba51a6aefc7fcb3)

  • Model Changes

    • Rename DefaultPetTask model to Checklist::TaskTemplate
    • Update class definition to be nested within Checklist module
    • Rename model file from default_pet_task.rb to checklist/task_template.rb
    • Update associations and validations within the model if necessary
  • Table Rename

    • Rename default_pet_tasks table to task_templates
    • Generate and run migration to rename the table
    • Update schema information in the model

-Update TaskTemplate and Organization Relationship (https://gist.github.com/ErinClaudio/636af5b5d4fb20042ee7ff996933f235)

  • Controller Changes (https://gist.github.com/ErinClaudio/75eb4688c3db1cd94089769bc265a1ab)

    • Rename DefaultPetTasksController to Checklist::TaskTemplatesController
    • Update class definition to be nested within Checklist module
    • Rename controller file from default_pet_tasks_controller.rb to checklist/task_templates_controller.rb
    • Update routes to reflect new controller name
  • Policy Changes

    • Rename DefaultPetTaskPolicy to Checklist::TaskTemplatePolicy
    • Update class definition to be nested within Checklist module
    • Rename policy file from default_pet_task_policy.rb to checklist/task_template_policy.rb
  • View Changes

    • Rename view directory from default_pet_tasks to checklist/task_templates
    • Update view filenames and references within the views
  • Tests Changes

    • Rename test files and directories from default_pet_task to checklist/task_template
    • Update test classes and references within the tests
    • Update fixtures or factory definitions
  • Routes Changes

    • Update config/routes.rb to reflect the new controller namespace and paths
  • Variables and Methods

    • Perform a global find and replace for DefaultPetTask to Checklist::TaskTemplate
    • Perform a global find and replace for default_pet_task to checklist/task_template
    • Check for any instances of the old table name default_pet_tasks and replace with task_templates
  • Documentation

    • Update any relevant documentation to reflect the changes in the model, controller, and other components
  • Database Updates

    • Ensure that all references to default_pet_tasks are updated to task_templates in the database-related code
  • Deploy and Test

    • Deploy the changes to a staging environment
    • Perform comprehensive testing to ensure everything works as expected

Notes

  • Refer to Why You Should Nest Modules in Ruby for the reasoning behind the nesting approach.
  • Ensure consistency in naming and structure throughout the codebase.
  • Comment below for any questions or clarifications.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment