On Mon, Aug 18, 2008 at 4:13 PM, Carlos Júnior <[EMAIL PROTECTED]> wrote: > > Hi folks, everything fine? > > I'm about to create a patch for this, but before I prefer to ask you and > listen to your opinions. > > Shouldn't ActiveRecord::ConnectionAdapters::TableDefinition#belongs_to > add indexes for the column by default? This is an approach that is > almost always taken. And when the belongs_to is polymorphic is true, it > should add indexes for both columns. > > Thank you, waiting your replies.
I'm not sure it's that straight forward, it depends on how the association is being used, is it the inverse of a has many, or just a reference to some lookup table. if you're only ever accessing it from the belongs_to side of the association then you're never doing a query like SELECT foo.whatever FROM foo WHERE bar_id = ? In that case, the index isn't needed. So I don't think we need a patch for this. -- Cheers Koz --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
