So i have a controller which subclasses down from the application controller. It defines a variety of protected methods, as well does the application controller. Now, if the application controller already defines those methods, I do not want them to be overwritten by its subclass. I’ve been trying things in this controller such as:
class SomeController < ApplicationController
protected
unless instance_methods.include? "some_method"
def some_method
end
end
However, using the Rails logger, I can still see that the some_method is being called.
Doing some further searching, I was able to figure it out :), thanks to the poster on this question here: How to judge whether a method has defined in a class?