José Valim
2008-May-22 16:07 UTC
Why belongs_to doesn''t have :select, :group, :offset and :limit options?
I was just wondering, cause with preload associations wouldn''t be a problem to support those keys. So if no problem actually exists, I''m offering myself to do a patch. =) --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
José Valim
2008-May-22 17:14 UTC
Re: Why belongs_to doesn''t have :select, :group, :offset and :limit options?
Ok! I was out of my mind! My problem is really with the :select key and I just thought, why not include others also? =P :group, :offset and :limit keys don''t make sense. So, changing my question: why belongs_to and has_one doesn''t support :select options? Really, we only have to change 2 lines of code! =) On May 22, 6:07 pm, José Valim <jose.va...@gmail.com> wrote:> I was just wondering, cause with preload associations wouldn''t be a > problem to support those keys. > > So if no problem actually exists, I''m offering myself to do a patch. =)--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
José Valim
2008-May-22 19:51 UTC
Re: Why belongs_to doesn''t have :select, :group, :offset and :limit options?
Actually, I''m not the only one crazy! =) Does anyone know why belongs_to accepts :order? Cause it isn''t even in the find_target method (active_record/ associations/belongs_to_association.rb, line 43) def find_target @reflection.klass.find( @owner[@reflection.primary_key_name], :conditions => conditions, :include => @reflection.options[:include], :readonly => @reflection.options[:readonly] ) end Thanks, José Valim. On May 22, 7:14 pm, José Valim <jose.va...@gmail.com> wrote:> Ok! I was out of my mind! > My problem is really with the :select key and I just thought, why not > include others also? =P > > :group, :offset and :limit keys don''t make sense. > > So, changing my question: why belongs_to and has_one doesn''t > support :select options? > > Really, we only have to change 2 lines of code! =) > > On May 22, 6:07 pm, José Valim <jose.va...@gmail.com> wrote: > > > I was just wondering, cause with preload associations wouldn''t be a > > problem to support those keys. > > > So if no problem actually exists, I''m offering myself to do a patch. =)--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Patch at: http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/241/ On May 22, 9:51 pm, José Valim <jose.va...@gmail.com> wrote:> Actually, I''m not the only one crazy! =) > > Does anyone know why belongs_to accepts :order? > Cause it isn''t even in the find_target method (active_record/ > associations/belongs_to_association.rb, line 43) > > def find_target > @reflection.klass.find( > @owner[@reflection.primary_key_name], > :conditions => conditions, > :include => @reflection.options[:include], > :readonly => @reflection.options[:readonly] > ) > end > > Thanks, > José Valim. > > On May 22, 7:14 pm, José Valim <jose.va...@gmail.com> wrote: > > > Ok! I was out of my mind! > > My problem is really with the :select key and I just thought, why not > > include others also? =P > > > :group, :offset and :limit keys don''t make sense. > > > So, changing my question: why belongs_to and has_one doesn''t > > support :select options? > > > Really, we only have to change 2 lines of code! =) > > > On May 22, 6:07 pm, José Valim <jose.va...@gmail.com> wrote: > > > > I was just wondering, cause with preload associations wouldn''t be a > > > problem to support those keys. > > > > So if no problem actually exists, I''m offering myself to do a patch. =)--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Michael Koziarski
2008-May-24 06:01 UTC
Re: Why belongs_to doesn''t have :select, :group, :offset and :limit options?
Nicely done, applied. On Fri, May 23, 2008 at 7:51 AM, José Valim <jose.valim@gmail.com> wrote:> > Actually, I''m not the only one crazy! =) > > Does anyone know why belongs_to accepts :order? > Cause it isn''t even in the find_target method (active_record/ > associations/belongs_to_association.rb, line 43) > > def find_target > @reflection.klass.find( > @owner[@reflection.primary_key_name], > :conditions => conditions, > :include => @reflection.options[:include], > :readonly => @reflection.options[:readonly] > ) > end > > Thanks, > José Valim. > > On May 22, 7:14 pm, José Valim <jose.va...@gmail.com> wrote: >> Ok! I was out of my mind! >> My problem is really with the :select key and I just thought, why not >> include others also? =P >> >> :group, :offset and :limit keys don''t make sense. >> >> So, changing my question: why belongs_to and has_one doesn''t >> support :select options? >> >> Really, we only have to change 2 lines of code! =) >> >> On May 22, 6:07 pm, José Valim <jose.va...@gmail.com> wrote: >> >> > I was just wondering, cause with preload associations wouldn''t be a >> > problem to support those keys. >> >> > So if no problem actually exists, I''m offering myself to do a patch. =) > > >-- 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 rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---