Ruby: Don't count private methods as Rails actions

Private instance methods on ActionController classes aren't valid
request handlers. Routing to them will raise an exception.
This commit is contained in:
Harry Maclean
2021-12-07 16:25:48 +13:00
committed by Harry Maclean
parent b80a84c156
commit e1d290d4c0
4 changed files with 14 additions and 7 deletions

View File

@@ -54,13 +54,13 @@ class ActionControllerControllerClass extends ClassDeclaration {
}
/**
* An instance method defined within an `ActionController` controller class.
* A public instance method defined within an `ActionController` controller class.
* This may be the target of a route handler, if such a route is defined.
*/
class ActionControllerActionMethod extends Method, HTTP::Server::RequestHandler::Range {
private ActionControllerControllerClass controllerClass;
ActionControllerActionMethod() { this = controllerClass.getAMethod() }
ActionControllerActionMethod() { this = controllerClass.getAMethod() and not this.isPrivate() }
/**
* Establishes a mapping between a method within the file