I have an application controller where I'm handling some authentication
class ApplicationController < ActionController::Base
before_action :prep_data
def prep_data
# code...
# authenticate
end
end
and I have a controller that inherits from this one
class OtherController < ApplicationController
def custom_action_method
end
end
can I skip the before_action
hook for the OtherController
for a custom action method custom_action_method
I found the answer, this is the syntax
class OtherController < ApplicationController
skip_before_action :prep_data, only: [:custom_action_method]
def custom_action_method
end
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With