<commit_before>h2. 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.


h2. Usage

h3.  Optionally generate the model 

  script/generate redeemable Coupon
  rake db:migrate

 
h3.  Make 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

h3. 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</code></pre>

Copyright (c) 2008 Squeejee, released under the MIT license<commit_msg>Tweaked README<commit_after>h2. 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.


h2. Usage

h3.  Optionally generate the model 

  script/generate redeemable Coupon
  rake db:migrate

 
h3.  Make 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

h3. 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</code></pre>

Copyright (c) 2008 Squeejee, released under the MIT license
{'fraction_non_alphanumeric': 0.06801909307875895, 'fraction_numerical': 0.060859188544152745, 'mean_word_length': 3.697478991596639, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '452838', 'n_tokens_mistral': 676, 'n_tokens_neox': 558, 'n_words': 220}