0

I have a fairly large ruby codebase and I am trying to find a method, current_user_has_ownership?. When I grep the codebase it is used in multiple places, but there is no definition found. When I look at the method with pry, the information I get is fairly unhelpful. It shows that the method is in this module:

#<Module:0x007f9f84550200>#methods:

Just a memory location. I assume that rails is creating the method for me, but how do I find what it is? I don't even know what it is called when rails does this for you, so I can't figure out what to google. What is going on and where can I find some documentation on how it works?

1
  • Are you using an auth gem/library? Also, just grepping/acking Ruby files in your gemset can be helpful, e.g., look for current_user_ Commented Oct 24, 2014 at 13:14

1 Answer 1

1

Try searching for def method_missing and define_method invocations. Chances are that current_user_has_ownership? is defined dynamically or intercepted by a method_missing method.

This will be harder to search for if this code lives in an included gem.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.