Check out example codes for "rails get source method". It will help you in understanding the concepts better.

Code Example 1

class A
  def foo
  end
end

file, line = A.instance_method(:foo).source_location
# or
file, line = A.new.method(:foo).source_location
puts "Method foo is defined in #{file}, line #{line}"
# => "Method foo is defined in temp.rb, line 2"

Learn ReactJs, React Native from akashmittal.com