Please unsubscribe me from this list. Thnks Sent on the Sprint® Now Network from my BlackBerry®
-----Original Message----- From: Matt Aimonetti <[email protected]> Sender: [email protected] Date: Tue, 23 Aug 2011 15:27:18 To: <[email protected]> Reply-To: [email protected] Subject: Re: [SDRuby] Re: Rails n00b question | Activerecord It must be, I'm indeed using Rails 3.1 - Matt On Tue, Aug 23, 2011 at 3:23 PM, Jason King <[email protected]> wrote: > Is this something new in 3.1 maybe? I'd never heard of that, so I just > tried it out - doesn't work in my 3.0.10 app. > > On Tue, Aug 23, 2011 at 3:08 PM, Matt Aimonetti > <[email protected]>wrote: > >> While I agree with Jason, using belongs_to in your migration has one >> major benefit: it automatically adds an index on the foreign key, and that's >> something most people forget ;) >> >> - Matt >> >> On Tue, Aug 23, 2011 at 3:03 PM, Jason King <[email protected]> wrote: >> >>> There are many points where the law of diminishing returns means that >>> Rails stops and just leaves the rest up to the developer. There's enough >>> room for error with has_many associations that this is one of those points. >>> Even the above code that creates the belongs_to side of the association is >>> not something that I ever actually remember to use. Opening the model file, >>> and adding the line manually is just so easy to do that it's not worth it >>> for my brain to think about this at the time I'm generating the migration. >>> >>> On Tue, Aug 23, 2011 at 2:03 PM, jvictor <[email protected]> wrote: >>> >>>> Thanks guys that worked. Any reason why rails does not "do the right >>>> thing" to setup a model with has_many ? >>>> >>>> On Aug 15, 5:21 pm, Jarin Udom <[email protected]> wrote: >>>> > Just for clarity, you don't need to make any database table changes to >>>> the >>>> > has_many model, unless you want a counter cache (in which case you >>>> would add >>>> > a users_count integer field to the groups table with a default value >>>> of 0, >>>> > and set :counter_cache => true on the belongs_to model). >>>> > >>>> > Jarin >>>> >>>> -- >>>> SD Ruby mailing list >>>> [email protected] >>>> http://groups.google.com/group/sdruby >>>> >>> >>> -- >>> SD Ruby mailing list >>> [email protected] >>> http://groups.google.com/group/sdruby >>> >> >> -- >> SD Ruby mailing list >> [email protected] >> http://groups.google.com/group/sdruby >> > > -- > SD Ruby mailing list > [email protected] > http://groups.google.com/group/sdruby > -- SD Ruby mailing list [email protected] http://groups.google.com/group/sdruby -- SD Ruby mailing list [email protected] http://groups.google.com/group/sdruby
