class HouseBuyersController < ...
def my_method
# How could I get here the relevant model name, i.e. \"HouseBuyer\" ?
end
end
If your controller and model are in the same namespace, then what you want is
controller_path.classify
controller_path
gives you the namespace; controller_name
doesn't.
For example, if your controller is
Admin::RolesController
then:
controller_path.classify # "Admin::Role" # CORRECT
controller_name.classify # "Role" # INCORRECT