Original idea by github.com/xing/flag_shin_tzu
warning:
NOT FOR PRODUCTION USE NOW
gem install tm-flagged
You have to add one field to your model, eg. named flags
add_column :transactions, :flags, :integer, :default => 0
just add new property
property :flags, Integer, :default => 0
just add this has_flags
to your model to define flags
has_flags 1 => :sun, 2 => :clouds, 3 => :rain, 4 => :frogs, 5 => :ufo
Then you could use autogenerated methods like
model.sun? # => true/false model.sun=true model.sun # => true/false
If you want to use another column than flags
, use :column
option
property :weather, Integer, :default => 0 has_flags 1 => :sun, 2 => :clouds, :column => :weather model.clouds?
Copyright © 2010 Tom Meinlschmidt, see LICENSE file