Reputation: 1026
I have two model like below,
orders table attributes:
# order_cost :float
# order_number :string(255)
order_items table attributes:
# order_id :integer
# price :float
# qty :integer
# name :string
Association: "Order has_many Order_items"
I want to find out any changes made in order_items from order.
Consider "Order 1" has "4 order_items". In that, 2nd order_item.name is changed & 3rd order_item.qty changed.
Now my question, How to find Order 1 associated record changes?
Upvotes: 1
Views: 1193
Reputation: 322
Maybe this answer would help. link
Apart from this I think there is no direct path to monitor changes of an association.
Upvotes: 1
Reputation: 1113
From what I understand, you want a record of the changes that took in your database. If so, there's a gem called paper_trail that can help you with this.
https://github.com/airblade/paper_trail
Upvotes: 1