Module: Army::Negative::MysqlAdapter
- Defined in:
- lib/army-negative/mysql_adapter.rb
Constant Summary collapse
- QUOTED_TRUE_AS_NEGATIVE_ONE =
Effectively replaces ActiveRecord::ConnectionAdapters::MysqlAdapter::QUOTED_TRUE
"-1".freeze
Class Method Summary collapse
-
.included(klass) ⇒ Object
Called when this module is included in ActiveRecord::ConnectionAdapters::MysqlAdapter.
Instance Method Summary collapse
-
#quoted_true_as_negative_one ⇒ Object
Replaces the original #quoted_true implementation.
Class Method Details
.included(klass) ⇒ Object
Called when this module is included in ActiveRecord::ConnectionAdapters::MysqlAdapter. Uses #alias_method to replace the original #quoted_true implementation with this module’s implementation named #quoted_true_as_negative_one
14 15 16 17 18 |
# File 'lib/army-negative/mysql_adapter.rb', line 14 def self.included(klass) klass.instance_eval do alias_method :quoted_true, :quoted_true_as_negative_one end end |
Instance Method Details
#quoted_true_as_negative_one ⇒ Object
Replaces the original #quoted_true implementation. When asked for a “quoted_true” value, return our variation (QUOTED_TRUE_AS_NEGATIVE_ONE) instead of the default QUOTED_TRUE value.
25 26 27 |
# File 'lib/army-negative/mysql_adapter.rb', line 25 def quoted_true_as_negative_one QUOTED_TRUE_AS_NEGATIVE_ONE end |