Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
31 lines (18 sloc) 571 Bytes

can_has_flagz

Provides handy flags hash for your models

Example Usage

User Model

class User < ActiveRecord::Base
  can_has_flagz

  after_save :send_confirmation_email

protected

  def send_confirmation_email
    UserMailer.deliver_confirmation_mail(self) unless flag[:skip_confirmation_email]
  end

end

Some Controller Method

@user = User.new(params[:user])
@user.flag[:skip_confirmation_email] = true
@user.save

Copyright

Copyright © 2011 Naomi Kyoto. See LICENSE for details.