diff --git a/lib/easymon/checks/active_record_mysql_writeable_check.rb b/lib/easymon/checks/active_record_mysql_writeable_check.rb index 88e9276..e17ac70 100644 --- a/lib/easymon/checks/active_record_mysql_writeable_check.rb +++ b/lib/easymon/checks/active_record_mysql_writeable_check.rb @@ -2,11 +2,9 @@ module Easymon class ActiveRecordMysqlWriteableCheck attr_accessor :klass - def initialize(klass, makara = false) + def initialize(klass) self.klass = klass - @query = "SELECT @@read_only" - # Trick makara into using the primary db - @query += " for UPDATE" if makara + @query = "SELECT @@read_only for UPDATE" end def check @@ -21,7 +19,7 @@ def check private def database_writeable? - klass.connection.execute(@query).entries.flatten.first == 0 + klass.connection.execute(@query).to_enum.first.first.to_i == 0 rescue false end diff --git a/lib/easymon/version.rb b/lib/easymon/version.rb index 7cb8b15..da29c31 100644 --- a/lib/easymon/version.rb +++ b/lib/easymon/version.rb @@ -1,3 +1,3 @@ module Easymon - VERSION = "1.6.1" + VERSION = "1.6.2" end