Created
July 3, 2018 06:25
-
-
Save goromlagche/dc2151c43037121b328d9b8651f272bf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module ArHelpers | |
| def listen_to_insert_ar_calls(table) | |
| ActiveSupport::Notifications | |
| .subscribe('sql.active_record') do |_, _, _, _, details| | |
| if details[:sql] =~ /INSERT INTO `#{table}`/ | |
| @sql = details[:sql] | |
| end | |
| end | |
| end | |
| end | |
| RSpec.configure do |config| | |
| config.include ArHelpers | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment