It looks like the ActiveRecord and generators namespace conventions
are inconsistent. Sometimes the model's table name defaults to
'module_classname' and sometimes to just 'classname.' I'm happy to
submit patches and tests, but what is the preferred default?
Example: /script/generate model -t carnivores/tiger name:string
Generator uses table_name 'carnivores_tigers' for fixtures and
migrations
Base#table_name defaults to 'tigers'
Base#table_name rdoc say 'carnivores_tigers'
Granted, this can be fixed by explicitly setting the table name in the
model class, but this doesn't seem right.
Thanks -- the intended convention wasn't clear to me. I'm thinking
both the generator and the docs need to be updated. The generator
interprets 'foo/bar' as module Foo, class Bar, but uses table_name
'foo_bar' for fixtures and migrations.
The Base#table_name docs say:
file class table_name
invoice/lineitem.rb Invoice::Lineitem invoice_lineitems
But Invoice::Lineitem#table_name returns 'lineitems' for this:
class Invoice::Lineitem < ActiveRecord::Base; end
I'm not sure if it's worth spec'ing all the nested module/class/class
permutations in the method docs -- we'd be essentially rewriting
what's pretty plain in the Ruby code. Maybe an explicit unit test like
below would make the intent plain (Contact < Client):