Will, You actually made a good point there. Removing it would break the support for reloading `has_one` relationship. Take a look at these SQLs:
> student = Student.first Student Load (0.5ms) SELECT "students".* FROM "students" ORDER BY "students"."id" ASC LIMIT 1 > student.user User Load (0.6ms) SELECT "users".* FROM "users" WHERE "users". "profile_id" = $1 AND "users"."profile_type" = $2 LIMIT 1 [["profile_id", 1 ], ["profile_type", "Student"]] > student.user(true) User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users". "profile_id" = $1 AND "users"."profile_type" = $2 LIMIT 1 [["profile_id", 1 ], ["profile_type", "Student"]] > student.user.reload User Load (0.5ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT 1 [["id", 1]] > For Kevin, chaining it in `has_many` actually works as `reload` would still return a CollectionProxy. However, as it does not work for `has_one` I think It does not make sense to remove it. In that case, I think we have keep it and just add associations(reload: true) to make it more obvious/verbose. Thanks for all the comments. -Prem On Tuesday, July 14, 2015 at 9:36:38 PM UTC-4, Kevin Deisz wrote: > > Can't you chain like record.associations(reload: true).where - if you do > reload I think we'd lose that > > On Tuesday, July 14, 2015, Prem Sichanugrist <[email protected] > <javascript:>> wrote: > >> I already asked a question about refactoring `record.associations(true)` >> -> `record.associations(reload: true)` here: >> https://groups.google.com/forum/#!topic/rubyonrails-core/f756F2DLuG0 >> >> However, Eugene raises an interesting question in the PR ( >> https://github.com/rails/rails/pull/20883#issuecomment-121419119) that >> it might actually make sense to just deprecate the support for >> `record.associations(true)`, and asks user to do >> `record.associations.reload` instead. >> >> I think it make sense, but I want to hear how people think first. >> Internally, it actually does the same thing because the current association >> reader code actually calls `#reload` internally as well. >> >> So, do you think it's a good idea to just deprecate and later remove the >> support for `record.associations(true)` instead? >> >> Thanks, >> Prem >> >> -- >> 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 [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at http://groups.google.com/group/rubyonrails-core. >> For more options, visit https://groups.google.com/d/optout. >> > > > -- > *Kevin D. Deisz* > *TrialNetworks* - part of DrugDev > Software Developer > 383 Elliot Street, Suite G > Newton, MA 02464 > +1 617.952.4071 x134 (office) > +1 703.615.0396 (mobile) > [email protected] <javascript:> > > -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/d/optout.
