tm-flagged¶ ↑
Original idea by github.com/xing/flag_shin_tzu
warning:
NOT FOR PRODUCTION USE NOW
Installation¶ ↑
gem install tm-flagged
Usage¶ ↑
ActiveRecord¶ ↑
You have to add one field to your model, eg. named flags
add_column :transactions, :flags, :integer, :default => 0
DataMapper¶ ↑
just add new property
property :flags, Integer, :default => 0
In model¶ ↑
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?
License¶ ↑
Copyright © 2010 Tom Meinlschmidt, see LICENSE file