diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/invite_code.rb | 3 | ||||
-rw-r--r-- | app/models/invite_code_validator.rb | 2 |
2 files changed, 2 insertions, 3 deletions
diff --git a/app/models/invite_code.rb b/app/models/invite_code.rb index 0086804..13c3a39 100644 --- a/app/models/invite_code.rb +++ b/app/models/invite_code.rb @@ -4,14 +4,13 @@ class InviteCode < CouchRest::Model::Base use_database 'invite_codes' property :invite_code, String, :read_only => true property :invite_count, Integer, :default => 0, :accessible => true - property :invite_max_uses, Integer, :default => 1, :accessible => true + property :max_uses, Integer, :default => 1 timestamps! design do view :by_invite_code view :by_invite_count - view :by_invite_max_uses end def initialize(attributes = {}, options = {}) diff --git a/app/models/invite_code_validator.rb b/app/models/invite_code_validator.rb index 9dfe6fa..676e4fa 100644 --- a/app/models/invite_code_validator.rb +++ b/app/models/invite_code_validator.rb @@ -18,7 +18,7 @@ class InviteCodeValidator < ActiveModel::Validator end def has_no_uses_left?(code) - code.invite_count >= code.invite_max_uses + code.invite_count >= code.max_uses end def add_error_to_user(error, user) |