These are chat archives for dry-rb/chat

21st
Jul 2016
Kiril Dokh
@dsounded
Jul 21 2016 07:37
@solnic Well, ok, will wait for your solution, mate :)
Kevin Ross
@rosskevin
Jul 21 2016 23:02
assuming option :model , -> { model }, is :auth_has_user? written correctly to fail if model.user.nil?
        validation do
          required(:email).filled
          required(:password).filled
          required(:jti).filled
          required(:iat).filled
          required(:exp).filled
          required(:sub).filled

          rule(auth_has_user?: [:email, :password]) do |email, password|
            email.filled?.then(password.filled?).then(!model.user.nil?)
          end
Kevin Ross
@rosskevin
Jul 21 2016 23:14
nevermind, I don't think this should be written as a validation, more like the heart of the operation