Good night people. I'm new to rails and I'm using translate to post in English.
a question. I have three tables: "ride_request_objects", "ata_objects" and "ride_requests".
They are related: Model: ride_requests
has_many :ride_request_objects
has_many :ata_objects, through: :ride_request_objects
Model: ride_request_objects
belongs_to :ata_object
Model: ata_objects
has_many :ride_request_objects
has_many :ride_requests, through: :ride_request_objects
I need to calculate the "total" in "ride_request_objects", which would be: ride_request_objects.quantity * ata_objects.unit_value
imagem da tabela: https://i.stack.imgur.com/uWv1g.png
How can I do this iteration for the calculation? would it be inside the Model of "ride_request_objects"?