I have a table created out of a XML based web service (Table1 below). Now after a given time I want to check if the data of that webservice has changed, so I just call the XML web service again and save that in another table (Table2 below).
Finally I want to compare the values of these both tables to determine if there are changes. How can I do that elegantly?
The problem is that attributes method is only working for ONE record not a whole table. I tried Table1.attributes == Table2.attributes
And in my opinion it is not possible to iterate parallely over two arrays and compare each value. So is it a good ide to create one array out of both tables with keys "old" and "new" and compare each old data with new data?
Like this:
JoinedArray = [{old => {first_ key_and_value_from_table1}, new =>{first_key_and_value_from_table2}, {old => {second_key_and_value_from_table1}, new =>{second_key_and_value_from_table2},]
JoinedArray.each do |e| e.old == e.new end
My tables look like this:
Table1:
id date title comment 1 2003-03-22 whatever good 2 2004-04-23 something bad
Table2:
id date title comment 10 2003-03-22 whatever good 12 2004-04-23 something bad 27 2005-08-19 anything good
I hope someone can give me a hint. I am completely stuck! Cheers, Sebastian