# How to reflect database change to model

**URL:** <https://www.ruby-forum.com/t/how-to-reflect-database-change-to-model/117624>\
**Category:** Rails\
**Created:** [October 18, 2007, 6:46pm UTC](https://www.ruby-forum.com/t/how-to-reflect-database-change-to-model/117624 "2007-10-18T18:46:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/f9ae1b/32.png) [@nick](https://www.ruby-forum.com/u/nick)\
**Post date:** [October 18, 2007, 6:46pm UTC](https://www.ruby-forum.com/t/how-to-reflect-database-change-to-model/117624/1 "2007-10-18T18:46:11Z")

</div>

Hi, all

When database schema changed dynamically, like you add new column, or  
create new table. The model will not  
reflect on those changes. How does active\_record handle this  
situation? Which class or method I need to look into it?  
Thank a lot!

---

<div class="post-metadata">

**Author:** ![nick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/f9ae1b/32.png) [@nick](https://www.ruby-forum.com/u/nick)\
**Post date:** [October 19, 2007, 10:43am UTC](https://www.ruby-forum.com/t/how-to-reflect-database-change-to-model/117624/2 "2007-10-19T10:43:23Z")

</div>

On 10/18/07, Nick [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi, all
> 
> When database schema changed dynamically, like you add new column, or  
> create new table. The model will not  
> reflect on those changes. How does active\_record handle this  
> situation? Which class or method I need to look into it?  
> Thank a lot!

Just a friendly warning; It’s _very_ unlikely that you should be  
changing the db schema dynamically.

Do consider having someone review your design.

Sincerely,  
Isak

---

<div class="post-metadata">

**Author:** ![nick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/f9ae1b/32.png) [@nick](https://www.ruby-forum.com/u/nick)\
**Post date:** [October 22, 2007, 9:56am UTC](https://www.ruby-forum.com/t/how-to-reflect-database-change-to-model/117624/3 "2007-10-22T09:56:46Z")

</div>

On Oct 19, 9:42 am, “Isak H.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> On 10/18/07, Nick [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Just a friendly warning; It’s _very_ unlikely that you should be  
> changing the db schema dynamically.
> 
> Do consider having someone review your design.

Sometimes legacy databases leave you no choice but to layer the same  
model over different database tables. You then have to think about how  
to reference columns when presenting data to the user. I’m ‘lucky’ (if  
anyone who has to work with legacy databases in RoR can be called  
lucky), in my case I have another table which tells me what’s in the  
first table.

Allan
