
Security News
PEP 810 Proposes Explicit Lazy Imports for Python 3.15
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
= Army::Negative -- Negative ones for true!
This gem is a simple ActiveRecord MySQL (+ARMy+) connection adapter monkey-patch. Put it in your +Gemfile+ and all your +true+ are belong to us! Or, rather, they'll suddenly become very negative, negative one specifically.
== Versioning
In general, army-negative versions are pinned to the supported rails version. Specifically, the major and minor version numbers will always match.
So, to use army-negative in a rails app, you'd use a version specifier in its entry in your +Gemfile+.
Examples:
gem "army-negative", "> 3.0.0" # for all rails 3.0.x apps
gem "army-negative", "> 3.1.0" # for all rails 3.1.x apps
gem "army-negative", "~> 4.5.6" # would work in any rails 4.5.x app
The exception to this rule is in rails 2.3.x apps (the oldest supported rails version). For these versions, you should use the latest 2.x version of army-negative (see the rails2 branch in the git repo).
== Usage
Simply put a line like the following in your +Gemfile+:
gem "army-negative", "~> 3.1.0"
Then do a bundle install on the command-line and you're set.
== What This Does
This makes ActiveRecord store the value -1 into your +TINYINT+ +boolean+ columns whenever they're set to +true+. It also makes ActiveRecord recognize -1 as +true+ when a +boolean+ field is queried.
NOTE: positive one and all other values that were interpreted as +true+ by the MySQL connection adapter will still be recognized as +true+ too.
== Why
This was written for a rails application that needed to access a legacy MySQL database. The new application needed to work concurrently with the existing (old) application, following its conventions.
The old application is a Microsoft Access 2003 program that uses the "linked tables" feature to store the data in a MySQL database. Microsoft's Visual Basic for Applications (VBA) stores +true+ values in memory with all bits turned on. If interpreted as an integer using two's complement, this is negative one. So the old application stores all our +true+ values as negative one. Because of this, many of the hand-written legacy queries also write and expect to read true values as negative one.
== The Name
Though no one besides myself is likely to see or use this gem, I still wanted to push it out to the public for posterity. The +ar+ in ARmy is for ActiveRecord while the +my+ in arMy is for MySQL. I'm sure you can guess what negative is supposed to reference.
== Authors and Credits
Authors:: Kendall Gifford
== License
Licensed using the standard {MIT License}[http://en.wikipedia.org/wiki/MIT_License]. See the file {LICENSE}[http://github.com/zettabyte/army-negative/blob/master/LICENSE] in the root folder of the project.
FAQs
Unknown package
We found that army-negative demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
Security News
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.