A namespaced model Alchemy::Page inside an engine.
Rails isolate_namespace Alchemy defines 'alchemy_pages' as table_name.
Calling tableize on an instance of Alchemy::Page returns 'alchemy/pages'
Shouldn't this be equal?
Whether Alchemy::Page.table_name is 'pages' or 'alchemy_pages' depends on the circumstances. In an isolated engine then it has the prefix but if it's a normal module inside an application then it doesn't unless you've added a table_name_prefix method which returns 'alchemy_'. If Alchemy is a model itself then Alchemy::Page.table_name will have the prefix.
As you can see table_name can vary so changing tableize to return 'alchemy_pages' won't always match table_name either. Also given this is a method that's been around since the beginning I would think changing the return signature now would run the risk of breaking apps so I don't think it's a good idea. However I would've thought a pull request with an additional table_name method added to AS::Inflector would be acceptable since it already has a foreign_key method, e.g:
You that should do the trick. Thanks!