> This leads me to another scenario. Namespaced models.... quite simply > as it stands you can in /app/models/ make a folder called /customer/ > there add tag.rb and note.rb. With models Customer::Tag and > Customer::Note. One thing is the table_name will remain "tags" and > "notes", which in this case should be prefixed by the namespace name > like "customer_tags" and "customer_notes". Also with the ability to > have a root model like Customer in /customer/root.rb. > > I'd love to hear that this can already be done as rails stands. I can > make the patches and submit them, however I don't want to divulge from > other design considerations.
>> class Customer < ActiveRecord::Base; end => nil >> Customer.table_name => "customers" >> class Customer::Tag < ActiveRecord::Base; end => nil >> Customer::Tag.table_name => "customer_tags" It's already working in edge, did you try it out? It's smart enough to prefix the table name if the parent is an active record model, not a regular module. Try this layout: app/models/customer.rb app/models/customer/tag.rb -- Rick Olson http://lighthouseapp.com http://weblog.techno-weenie.net http://mephistoblog.com --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
