I got the original location by doing:
current_user.method(:is_admin?).source_location
(Thanks to this @BroiSatse)
This pointed me to this file in role_model: https://github.com/martinrehfeld/role_model/blob/master/lib/role_model/class_methods.rb
It turns out that role_model dynamically creates methods based on the assigned roles, so for some reason it does not appear in the source ...
From class_methods.rb :
# Defines dynamic queries for :role # #is_<:role>? # #<:role>? # # Defines new methods which call #is?(:role) def define_dynamic_queries(roles) dynamic_module = Module.new do roles.each do |role| ["#{role}?".to_sym, "is_#{role}?".to_sym].each do |method| define_method(method) { is? role } end end end include dynamic_module end
Yarin source share