diff options
Diffstat (limited to 'app/models/invite_code_validator.rb')
-rw-r--r-- | app/models/invite_code_validator.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/app/models/invite_code_validator.rb b/app/models/invite_code_validator.rb index 73c333a..d03d510 100644 --- a/app/models/invite_code_validator.rb +++ b/app/models/invite_code_validator.rb @@ -3,7 +3,7 @@ class InviteCodeValidator < ActiveModel::Validator user_invite_code = InviteCode.find_by_invite_code user.invite_code - if not_existent?(user_invite_code.invite_code) + if not_existent?(user.invite_code) add_error_to_user("This is not a valid code", user) elsif count_greater_than_zero?(user_invite_code.invite_count) @@ -18,6 +18,7 @@ class InviteCodeValidator < ActiveModel::Validator private def not_existent?(code) InviteCode.find_by_invite_code(code) == nil + end def count_greater_than_zero?(code) |