0

We are running a rails+mysql application. In my specific requirement I want all my developers to access mysql only throught the rails API. I want to disable all direct mysql queries outside ActiveRecord.

This is because we run a lot of callbacks at activerecord to maintain integrity of data.

How to implement this?

tamizhgeek
  • 1,371
  • 3
  • 13
  • 25

1 Answers1

4

How to implement this?

Code reviews.

You're not going to prevent "direct mysql queries outside ActiveRecord", because you can do direct SQL queries with ActiveRecord:

Model.find_by_sql("DELETE * FROM admin_table")

Your best approach will probably be to ensure that the code your developers are writing is following the best-practices you determine. Do this by peer-review processes and education.

Pavling
  • 3,933
  • 1
  • 22
  • 25