hanami / utils

Ruby core extentions and class utilities for Hanami

Home Page:http://hanamirb.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Singularize get's confused with snake_case words

mauromorales opened this issue · comments

I was trying hanami and created a resource called :control_exercises. I wasn't able to use the path helper so I listed my routes and saw this:

                root GET, HEAD  /                              Web::Controllers::Home::Index
     control_exerces GET, HEAD  /control_exercises             Web::Controllers::ControlExercises::Index
 new_control_exercis GET, HEAD  /control_exercises/new         Web::Controllers::ControlExercises::New
     control_exerces POST       /control_exercises             Web::Controllers::ControlExercises::Create

Digging deeper I came into the utils repo and found that the problem is that when passed through inflector singularize, the special word exercise doesn't get picked because of the control_ prefix.

singulars.apply(string)