Using rails 4, 'popup_cta'.classify
results into PopupCtum
instead of PopupCta
I tried 'popup_cta_'.classify
generates the expected result PopupCta
Also, when add a resource of popup_cta
in the routes the rails will create popup_ctam
helper
Any idea?
That's because classify works under the assumption that you're passing as parameter a table name, which are usually in plural and transform it to singular.
I'm not an native english speaker, so I'm not quite sure what's that specific rule where words in plural that finish with a
, in their singular form finish with um
, but what you want to achieve, it can be done with camelize
:
'popup_cta'.camelize # => "PopupCta"
About your issue with routes, you could override the helper name with :as
.