If I want to call a class method (mailer method in rails), providing its name in a variable. How can I do that? For objects, we can use send
, or we can use read_attribute
to read some values
my_object.send("#{self.action_type(self)}")
my_object.read_attribute("#{self.action_type}_email")
But for class names, nothing is working as send
is defined as instance method in object class. I want something like this, which will not work as send
can't be applied on class:
Notifier.send("#{self.action_type(self)}").deliver