This will be a pretty rough default for some DBs that have short identifier maximums (Oracle is *30* characters).
We’d also need to be explicit about what happens with models that descend from namespaced classes (from an engine, for instance). IIRC, current behavior derives the table name for subclasses from the direct descendant of AR::Base. —Matt Jones On Feb 3, 2015, at 4:52 AM, Matthew Dunbar <m...@mattdsworld.com> wrote: > Suggesting that we can auto generate the prefix based on the module name, > rather than setting it with the existing method. Then eventually this feels > like a sensible default to me. > > On Sunday, February 1, 2015 at 7:39:58 AM UTC-5, Carlos Antonio da Silva > wrote: > Not sure I get what's the actual difference between a new option like that > and setting the table name prefix on the module, which will work for all > classes under it? Can you expand on that a bit? > > On Sat, Jan 31, 2015 at 4:52 AM, Matthew Dunbar <ma...@mattdsworld.com> wrote: > I will implement this myself, looking for feedback on if it'd be accepted and > how the community feels about the long term of this being enabled by default. > > I often run into conflicts between table names when running multiple fairly > heavyweight engines that all deal with e-commerce (and in turn many have > tables such as most recently payments that conflict). The current solution is > to manually specify the table prefix in the appropriate gem / module. > > I am suggesting that we add a inherits_prefix_from_namespace flag to models, > then eventually in the long term (perhaps rails 5) defaulting this to be > enabled. > > Ideally this would work as follows: > > module Example > module Widgets > class Test < ActiveRecord::Base > inherits_table_prefix_from_namespace: true > end > end > end > > Rather than having its table name be tests , the table name would be > example_widgets_tests. > > In the case that a prefix is specified, the table name would be > prefix_example_widgets_tests (rather than prefix_tests). > > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-co...@googlegroups.com. > To post to this group, send email to rubyonra...@googlegroups.com. > Visit this group at http://groups.google.com/group/rubyonrails-core. > For more options, visit https://groups.google.com/d/optout. > > > > -- > At. > Carlos Antonio > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-core+unsubscr...@googlegroups.com. > To post to this group, send email to rubyonrails-core@googlegroups.com. > Visit this group at http://groups.google.com/group/rubyonrails-core. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/d/optout.
signature.asc
Description: Message signed with OpenPGP using GPGMail