vendredi 12 mars 2021

How to redirect to Not Found page if an invalid URL is passed on Active Admin?

I'm using ActiveAdmin gem in my Rails application. I have an Item resource in the ActiveAdmin. I have allowed all the actions except new.

actions :all, except: [:new]

But in the URL if explicitly passed /admin/items/new, it throwing an ActiveRecord::Not Found error as it taking new as an id. In the description of the error, it is showing "Couldn't find Item with 'id'=new. I want to redirect to 404 or Not found page if an invalid url is passed. Can someone help me with this? Thanks is advance!

Aucun commentaire:

Enregistrer un commentaire