0

I have a messages controller, so that printers and users can send messages to each other. I need to Auth both printers and user. Is there a way of doing something like below in the controller?

before_action :authenticate_printer! || before_action :authenticate_user!

1 Answer 1

1

You can define a third method

before_action :authenticate

def authenticate
  authenticate_printer! || authenticate_user!
end

Of course, authenticate_printer! and authenticate_user! must return false on failure, and not raise.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.