I'm writing a Rails plugin, and need to be able to dynamically determine which model a controller is associated with. For example, if I have a PeopleController, I need a clean way to determine that the controller handles Person models.
I've had a look through the API and haven't found a method for it.
Is the only way to do this as a regexp combined with some ActiveSupport
inflection trickery like singularize
?
If so, are there any pitfalls with this approach? What are the edge cases?