RubyFlow The Ruby and Rails community linklog

[Rails plugin] has_many_booleans

has_many_booleans is an ActiveRecord plugin which creates virtual boolean attributes for a model. When the object gets saved, the plugin transforms all attributes into a single integer, using a bitset. So you can easily add new attributes without changing the database structure. - more information -

Comments

it may have a problem with lost updates. imagine 2 processes changing different booleans on the same AR object, the last update wins and changes lost.

Hi epirogov, there is a :lazy => false option, which has the effect that the boolean integer gets updated every time a virtual boolean changes.

There is a similar project:

http://github.com/xing/flag_shih_tzu

There are another similar project:

http://github.com/maiha/acts_as_bits

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in