I have installed the plugin eagerfindersql. if i try to insert :limit and offset in find: events=Event.find(:all, :limit=>10,:offset => 0,:include => [:event_type_names,{:event_dates => {:place => :locality}}], :finder_sql => query, :column_mapping => {... this not works and show all elements. if i try to insert limit in query. the events that returning are less of 10. Beacuse all events have more event_dates. How i can to use limit??? Thanks -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 10 Dec 2007, at 13:19, Luca Roma wrote:> > I have installed the plugin eagerfindersql. > > if i try to insert :limit and offset in find: > events=Event.find(:all, :limit=>10,:offset => 0,:include => > [:event_type_names,{:event_dates => {:place => :locality}}], > :finder_sql => query, > :column_mapping => {... > > > this not works and show all elements. > > if i try to insert limit in query. the events that returning are > less of > 10. >With the plugin, the sql that is used is the one passed via the :finder_sql. Just looking quickly at the plugin''s code, this suggests that it will ignore the :limit and :offset you''re supplying. You just have to write the whole query yourself (which is rather the point of the plugin) Fred> Beacuse all events have more event_dates. > > How i can to use limit??? > > Thanks > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> On 10 Dec 2007, at 13:19, Luca Roma wrote: > >> this not works and show all elements. >> >> if i try to insert limit in query. the events that returning are >> less of >> 10. >> > With the plugin, the sql that is used is the one passed via > the :finder_sql. > Just looking quickly at the plugin''s code, this suggests that it will > ignore the :limit and :offset you''re supplying. > You just have to write the whole query yourself (which is rather the > point of the plugin) > > FredBut if i insert limit in the finder_sql the number of the elements selected are less of limit setted. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 10 Dec 2007, at 14:42, Luca Roma wrote:> > Frederick Cheung wrote: >> On 10 Dec 2007, at 13:19, Luca Roma wrote: >> >>> this not works and show all elements. >>> >>> if i try to insert limit in query. the events that returning are >>> less of >>> 10. >>> >> With the plugin, the sql that is used is the one passed via >> the :finder_sql. >> Just looking quickly at the plugin''s code, this suggests that it will >> ignore the :limit and :offset you''re supplying. >> You just have to write the whole query yourself (which is rather the >> point of the plugin) >> >> Fred > > But if i insert limit in the finder_sql the number of the elements > selected are less of limit setted.You''re probably running into the fact that limiting and eager loading don''t really mix. You''ll probably have to replicate what activerecord does under the hood when you don''t use eagerfindersql: 1 query to determine which events to load (and get back from that the ids to load), and a second query that loads them with the associations. Fred --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---