This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
MIT-LICENSE | Wed Jul 09 20:21:01 -0700 2008 | |
| |
README.textile | Wed Jul 09 20:29:02 -0700 2008 | |
| |
Rakefile | Wed Jul 09 20:21:01 -0700 2008 | |
| |
init.rb | Wed Jul 09 20:21:01 -0700 2008 | |
| |
install.rb | Wed Jul 09 20:21:01 -0700 2008 | |
| |
lib/ | Sat Jul 12 08:02:58 -0700 2008 | |
| |
test/ | Wed Jul 09 20:21:01 -0700 2008 | |
| |
uninstall.rb | Wed Jul 09 20:21:01 -0700 2008 |
README.textile
ActsAsRedeemable
Adds redemption capability to a model for items like coupons, invitation codes, etc. Each redeemable gets a unique code upon creation that can be sent in an email or printed as a coupon code.
Usage
Optionally generate the model
script/generate redeemable Coupon rake db:migrateMake your ActiveRecord model act as redeemable.
class Coupon < ActiveRecord::Base
acts_as_redeemable :valid_for => 30.days, :code_length => 8 # optional expiration, code length
end
Create a new instance
c = Coupon.new
c.user_id = 1 # The user who created the coupon
c.save
c.code
# "4D9110A3"
c.created_at
# Fri Feb 15 14:56:37 -0600 2008
c.expires_on
# Fri Mar 16 14:56:37 -0600 2008
Copyright © 2008 Squeejee, released under the MIT license







