How to raise 422 error in Rails

I was updating error pages to follow latest GDS standard (https://design-system.service.gov.uk/patterns/). I needed to test the 422 page.

After few failed attempts I found this solution to work, just put this code in your index method on your home page:

    raise(ActionController::InvalidAuthenticityToken)

I hope it helped.

Author: Petr Zaparka

I'm a developer, but I think that communication is the most important aspect of product development. That's the reason why I'm focused on understanding how to talk to my peers and customer by improving my soft skills.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.