<commit_before>---
layout: post
title: Rails rename a model (table)
author: <NAME>
---

DRAFT------------------

create a migration
- remove indexes
- rename table
- add indexes back
- rename relational tables has_many through or habtm
- rename foreign keys for relational tables

POLYMORPHIC TABLES NEED RECORDS TO BE RENAMED

run the migration
- check schema

rename files and contents

assets
- rename javascript and scss files

controllers
- rename the file<commit_msg>start new blog on rails rename model<commit_after>---
layout: post
title: Rails rename a model (table)
author: <NAME>
---

DRAFT------------------

add active record to the title
if automating the renaming process search for singular, plural. Don't replace everything!



create a migration
- remove indexes
- rename table
- add indexes back
- rename relational tables has_many through or habtm
- rename foreign keys for relational tables

POLYMORPHIC TABLES NEED RECORDS TO BE RENAMED

run the migration
- check schema

rename files and contents

assets
- rename javascript and scss files

controllers
- rename the file
{'fraction_non_alphanumeric': 0.08051235132662397, 'fraction_numerical': 0.0, 'mean_word_length': 3.4653061224489794, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1882915', 'n_tokens_mistral': 329, 'n_tokens_neox': 291, 'n_words': 145}