summaryrefslogtreecommitdiff
path: root/app/models/invite_code.rb
diff options
context:
space:
mode:
authorankonym <ankonym@gmail.com>2015-08-25 14:11:00 +0200
committerankonym <ankonym@gmail.com>2015-09-28 15:12:45 +0200
commit45c3fadd930a474951bd918a50e1ea2b00af75c7 (patch)
tree3439fc94cc8e6533a92d06a2fd751a3804e71050 /app/models/invite_code.rb
parent5f9aec72f124a971b765c14052363f3ce1e16c65 (diff)
Make sure codes can only be used once, fix validations
We introduced a count on invite codes to make sure that (at the moment) codes can only be used once. (The code will also allow multi-use codes in the future.) Also, some of our validations weren't validating against the correct data, which is now fixed.
Diffstat (limited to 'app/models/invite_code.rb')
-rw-r--r--app/models/invite_code.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/app/models/invite_code.rb b/app/models/invite_code.rb
index d52436f..30a6498 100644
--- a/app/models/invite_code.rb
+++ b/app/models/invite_code.rb
@@ -3,10 +3,13 @@ require 'coupon_code'
class InviteCode < CouchRest::Model::Base
use_database 'invite_codes'
property :invite_code, String, :read_only => true
+ property :invite_count, Integer, :default => 0, :accessible => true
+
timestamps!
design do
view :by_invite_code
+ view :by_invite_count
end
def initialize(attributes = {}, options = {})