How to skip a before_filter in dev environment

351 Views Asked by At

I want to skip before_filter authenticate_user! when it's in Rails.env:dev. Otherwise, do the authenticate action in Rails.env:product

1

There are 1 best solutions below

0
Sebastián Palma On

You can use skip_before_filter with the if option:

skip_before_filter :authenticate_user!, if: -> { Rails.env.development? }

(skip_before_action depending on your Rails version)