I need to integrate a Ruby on Rails application with a 3rd-party application, which will share a common PostgreSQL database. That is, both the Rails app and the 3rd-party app will be using the same PG database.
Is it possible to set a listener within the Rails app, such that an event is fired when the 3rd-party app adds, edits or deletes a database record?
For example, say I have a Book
model defined in Rails, and the 3rd-party app adds a new row in the database's Book table (not via the BooksController
).
Can the Rails application detect that a new record has been added, or that an existing record has been edited/deleted?