ruby on rails use variable in association call-Collection of common programming errors

Here is the same answer as ~AmirRubin, but fleshed out more.

I am assuming that friend was the object, method was the helper, .profile is the method you want the helper to use.

Define your helper as:

def call_method(object, method_name)
  object.send(method_name)
end

In your view call it as:


Adjust this if my assumptions are wrong. If you need to send the method name (symbol) to the partial pass it in the locals.

Originally posted 2013-11-09 23:30:43.