Hello All, I''ve submitted a patch (http://dev.rubyonrails.org/ticket/8898) to enable #underscore to be reversible. I had trouble creating a class named "CRSContact", and it turns out that underscore and camelize are not reversible in cases where there are 3 or more capital letters. As there is a dependency between class name and file name I think it would be beneficial for underscore to be reversible, however this would change the existing behavior of how it handles acronyms. Thanks, Rich C. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
The standard approach to acronyms in class names is to capitalize only the first letter, e.g., CrsContact. The underscore/camelize process is then perfectly reversible. - Jamis On 7/6/07, Rich C <conejo2005@gmail.com> wrote:> > Hello All, > I''ve submitted a patch (http://dev.rubyonrails.org/ticket/8898) to > enable #underscore to be reversible. > > I had trouble creating a class named "CRSContact", and it turns out > that underscore and camelize are not reversible in cases where there > are 3 or more capital letters. As there is a dependency between class > name and file name I think it would be beneficial for underscore to be > reversible, however this would change the existing behavior of how it > handles acronyms. > > Thanks, > > Rich C. > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
I ran into this same situation and just went with the Rails flow. Aesthetically the class name is not ideal, but the underscore crs_contact is certainly nicer than c_r_s_contact. Given that hundreds of apps probably rely on this behaviour it seems like a bad idea to change it. On 7/6/07, Rich C <conejo2005@gmail.com> wrote:> > Hello All, > I''ve submitted a patch (http://dev.rubyonrails.org/ticket/8898) to > enable #underscore to be reversible. > > I had trouble creating a class named "CRSContact", and it turns out > that underscore and camelize are not reversible in cases where there > are 3 or more capital letters. As there is a dependency between class > name and file name I think it would be beneficial for underscore to be > reversible, however this would change the existing behavior of how it > handles acronyms. > > Thanks, > > Rich C. > > > > >-- Gabe da Silveira http://darwinweb.net --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---