How to check the calling method?

Hey guys, quick question,

What's the easiest way in rail to check which action called another

For example, say I wanted to run a method inside a method but only if
called by a specific top method.


def method_1
  # Only run if called by a specific method
  if <insert check calling method code here> == "specific method"


You can use caller inside the method, or perhaps params[:action].

I wouldn’t do it that way though. Just allow the method to take a parameter specifiying if that extra bit of code should be run.