An example of Rails controller which defines a private method:
class ApplicationController < ActionController::Base
private
def authorization_method
# do something
end
end
Then, it's being used in a subclass of ApplicationController
:
class CustomerController < ApplicatioController
before_action :authorization_method
# controller actions
end
How is it possible that a private method is called from its subclass? What is the meaning of private
in Ruby?