ruby on rails 4 - How to couple activeresource object with activerecord 'same' object? -


I am thinking that an active resource is an efficient and elegant way to link hardware objects with an activerecord object .

I am setting up a payment system for my application, it works with an API in which the user tables, wallet tables, ... I want to store all this information in my application database . For example: - When I create a wallet_object_api_side, I want to store it in wallet_object_my_database - when I update wallet_object_api_side, I want to update wallet_object_my_database

wallet_object_api_side always wallet_object_my_database

Should there be an excellent way to create an API object and save it in your database in the same request?

Thank you.

You can do this with a Rail Callback.

But the big question is why are you trying to do this? It is dangerous to rely on remote data replication locally and vice versa. If API is the definitive source of data, then you should go to the API when you need the data.

What if some changes in the API database; How is your application going to learn about this and dealing with it?


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

javascript - amcharts makechart not working -

java - Algorithm negotiation fail SSH in Jenkins -