Ruby

Overriding Ruby on Rail's Plural Table Name Mappings

I've just started playing with Ruby on Rails and the first annoyance I found was that they make an assumption that all my table names will be plural. They have some sort of mapping of singular names to plural names (English only of course). I like the auto-discovery of the columns, etc, but I'm not a big fan of something thinking it knows how to do it better or what I want to do. This is really why I despise Microsoft®, but that's another story. So, after much searching I found this little tidbit that lets me tell the database model what the table name is that I want to map it to. Seems like this should just be required unless your model name matches your table name. It is really a big problem to have a Users table and refer to it as Users insted of as User? My particular problem is that I have an Authentication table from a legacy system that interfaces with Java code as well. I'm not rewrting a whole lot of SQL statements just becuase Ruby wants to do things its way. So, the solution is the following:

Syndicate content