In your Project's Gemfile
gem 'acts_as_flags'
In your model
acts_as_flags :flags, %w[ sent re_sent ]
In your migration
#rails g migration AddFlagsMaskToFoo
add_column :foos, :flags_mask, :integer
#rake db:migrate
Flags setter and getter
@foo.flags = [ "sent" ]
@foo.flags
=> [ "sent" ]
Searching records by flags
It will create a method for each possible flag
ex:
Foo.only_sent
=> Return all foos with the flagged sent
Foo.only_re_sent
=> Return all foos with the flagged re_sent
Getting the available flags foy your field
available_<field> will give you the available flags for that field
Ex:
Foo.available_flags
=> ["sent", "re_sent"]