# How to flag changes and load data from another table?

**URL:** <https://www.ruby-forum.com/t/how-to-flag-changes-and-load-data-from-another-table/122984>\
**Category:** Rails\
**Created:** [December 13, 2007, 7:42am UTC](https://www.ruby-forum.com/t/how-to-flag-changes-and-load-data-from-another-table/122984 "2007-12-13T07:42:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jojobert](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ee7513/32.png) [@jojobert](https://www.ruby-forum.com/u/jojobert)\
**Post date:** [December 13, 2007, 7:42am UTC](https://www.ruby-forum.com/t/how-to-flag-changes-and-load-data-from-another-table/122984/1 "2007-12-13T07:42:35Z")

</div>

Hi,

i have a course table, programme table and a degree table.

The user has to create courses and programmes  
and when they add courses to programmes, it will be stored in the degree  
table.

I have four fields from Course Table.

- Pre-requisite
- Excluded-Combination
- Grouping
- Remark

I have these exact same fields in the Degree Table.

When a user adds a course to a programme, I want to be able to retrieve  
the value of the four fields that are already stored in the course  
table. (depending on what course they choose to add to programme)

* * *

eg.

(Course table) Record 1:  
course\_id: cou568  
Pre-requisite: ab  
Excluded-Combination: cd  
Grouping: ef  
Remark: hi

* * *

how do i make it so that the user will be able to see the values in the  
add course to programme form?

(something like editing)

* * *

eg. when user decides to add cou568 to a programme, the app will  
retrieve the pre-req, etc from cou568 records and display it in the form

(Degree table) Record 1:  
Pre-requisite: ab, 12\*  
Excluded-Combination: cd  
Grouping: ef, 145\*  
Remark: hi, 155\*

* * *

- denoting that the user has added these new values

also, if the users adds on to the values, how do i add a symbol/or  
something to show that the value has been changed? (like you see above)

i heard that this might be possible using ajax or a continuation form,  
but i have no idea how to go about it…

sorry if this is so lengthy, i tried to explain as simply as possible  
thanks in advance!

---

<div class="post-metadata">

**Author:** ![jojobert](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ee7513/32.png) [@jojobert](https://www.ruby-forum.com/u/jojobert)\
**Post date:** [December 14, 2007, 1:28am UTC](https://www.ruby-forum.com/t/how-to-flag-changes-and-load-data-from-another-table/122984/2 "2007-12-14T01:28:15Z")

</div>

Bcp wrote:

> Having same fields in two tables indicate code smell. Find the concept  
> that is represented by those attributes and create a new model for it.  
> Then use composed of macro in ur other two classes.
> 
> Sent from my iPhone
> 
> On Dec 12, 2007, at 10:42 PM, Jojo M.  
> \<removed\_email\_address@domain.invalid

sorry i’m not very good at ruby on rails, and i don’t know what you mean  
here, could u maybe direct me to a website that guides me on how to do  
this?

---

<div class="post-metadata">

**Author:** ![jojobert](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ee7513/32.png) [@jojobert](https://www.ruby-forum.com/u/jojobert)\
**Post date:** [December 13, 2007, 8:16am UTC](https://www.ruby-forum.com/t/how-to-flag-changes-and-load-data-from-another-table/122984/3 "2007-12-13T08:16:10Z")

</div>

Having same fields in two tables indicate code smell. Find the concept  
that is represented by those attributes and create a new model for it.  
Then use composed of macro in ur other two classes.

Sent from my iPhone

On Dec 12, 2007, at 10:42 PM, Jojo M.  
\<removed\_email\_address@domain.invalid
