I was working in one of my project, where we were required to connect to 2 databases.
- First we had access to do CRUD
- Second we were only supposed to READ
For the second DB we wanted to raise exception from Rails, if somebody by accident tried to create/edit. ActiveRecord has this attribute as part of all models already called
@readonly. There are definitely few challenges. Here is what I did:
The sweet model:

If somebody tries to add a record:

If someone tries destroy

What if someone uses delete

Rest in peace !!
No comments:
Post a Comment