Turns out mom is not the cause of the issue as it just passes the unmodified prefix on to the injected name_generator (e.g. Ramom::Naming::NaturalJoin) which in turn incorrectly handles empty string prefixes.
Given mom's contract of simply passing on the prefix, it is any name_generator's responsibility to expect more or less "arbitrary" values. In Ramom::Naming::NaturalJoin specifically, this means that expecting prefix == false in addition to prefix == '' is beneficial from an end user API pov.
register :page_info, prefix: false do
map :number
map :limit
map :total
end
looks way better (more intuitive) than
register :page_info, prefix: '' do
map :number
map :limit
map :total
end
Originally filed at https://github.com/snusnu/mom/issues/5
Turns out mom is not the cause of the issue as it just passes the unmodified
prefix
on to the injectedname_generator
(e.g.Ramom::Naming::NaturalJoin
) which in turn incorrectly handles empty string prefixes.Given mom's contract of simply passing on the
prefix
, it is anyname_generator
's responsibility to expect more or less "arbitrary" values. InRamom::Naming::NaturalJoin
specifically, this means that expectingprefix == false
in addition toprefix == ''
is beneficial from an end user API pov.looks way better (more intuitive) than