Quantcast
Channel: Active questions tagged ruby - Stack Overflow
Viewing all articles
Browse latest Browse all 4612

Rails 7 - How to run a before action with inline code only for an action

$
0
0

In Rails 7.1 with Ruby 3.2.2, what's the correct syntax to run a before_action filter with inline code only for a specific action?

I have tried everything suggested in Before action with inline method, but I always get an error.

before_action only: :destroy, { authorize!(with: AllowAllPolicy) }before_action only: [:destroy], { authorize!(with: AllowAllPolicy) }before_action { authorize!(with: AllowAllPolicy) }, only: :destroybefore_action { authorize!(with: AllowAllPolicy) }, only: [:destroy]before_action { authorize!(with: AllowAllPolicy), only: :destroy }before_action { authorize!(with: AllowAllPolicy), only: [:destroy] }before_action(only: :destroy, { authorize!(with: AllowAllPolicy) })before_action(only: [:destroy], { authorize!(with: AllowAllPolicy) })

Viewing all articles
Browse latest Browse all 4612

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>