• 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

変更点

  • (1) Rails2 の dirty column に対応
  • (2) 一括設定機能を追加

ruby>>
class User < ActiveRecord::Base
acts_as_bits :flags, %w( admin create read update delete )
end

user = User.new
user.admin = true # (1)
user.changed? # => true

user.flags = true # (2)
user.flags # => "11111"
<<--

インストール
shell>>
% gem install maiha-acts_as_bits --source=http://gems.github.com
<<--

posted by maiha maiha on Wed 21 Jan 2009 at 19:56 with 0 comments