On Jueves, 10 de Junio de 2010 11:28:09 [email protected] escribió:
> Hi,
>
> that s an easy fix:

Thanks, I have fixed it in master and rails-2.3. However, your fix breaks 
pagination with sorting by method, you must store the slice in 
sorted_collection like:
sorted_collection = sorted_collection.slice(offset, per_page) if 
options[:pagination]

>
> in finder.rb change the following:
> pager = ::Paginator.new(count, options[:per_page]) do |offset,
> per_page|
>           sorted_collection =
> sort_collection_by_column(klass.all(finder_options),
> *options[:sorting].first)
>           sorted_collection.slice(offset, per_page) if
> options[:pagination]
>         end
>
> to
>
> pager = ::Paginator.new(count, options[:per_page]) do |offset,
> per_page|
>           sorted_collection =
> sort_collection_by_column(klass.all(finder_options),
> *options[:sorting].first)
>           sorted_collection.slice(offset, per_page) if
> options[:pagination]
>           sorted_collection
>         end
>
> --
> Volker
>
> On Jun 10, 10:34 am, "Sergio Cambra .:: entreCables S.L. ::."
>
> <[email protected]> wrote:
> > On Miércoles, 9 de Junio de 2010 21:01:00 Klaus Huber escribió:
> > > Hello,
> > >
> > > disabling pagination causes an error in a controller which is sorted by
> > > a foreign key. If the same controller is sorted (default or by hand) by
> > > an other column (which is not a foreig key) everything is fine.
> > >
> > > Error:
> > > ---------------
> > >  Showing
> > >
> > > vendor/plugins/active_scaffold/frontends/default/views/_list_messages.h
> > >tml. erb where line #18 raised:
> > >
> > > You have a nil object when you didn't expect it!
> > > You might have expected an instance of Array.
> > > The error occurred while evaluating nil.empty?
> > >
> > > Extracted source (around line #18):
> > >
> > > 15:                 }, :href => href %>
> > > 16:           <% end -%>
> > > 17:         </p>
> > > 18:         <p id="<%= empty_message_id %>" class="empty-message" <%= '
> > > style="display:none;" ' unless @page.items.empty? %>>
> > > 19:           <%= as_(active_scaffold_config.list.no_entries_message)%>
> > > 20:         </p>
> > > ---------------
> > >
> > > I think this is caused by the finder which reports an empty items-set
> > > in the page-object.
> > >
> > > Can I provide further information?
> >
> > Post full backtrace, disabling backtrace silencers (uncomment last line
> > in config/initializers/backtrace_silencers.rb)
> >
> > Post sql queries with pagination and without pagination.
> >
> > --
> > Sergio Cambra .:: entreCables S.L. ::.
> > Mariana Pineda 23, 50.018 Zaragoza
> > T) 902 021 404 F) 976 52 98 07 E) [email protected]

-- 
Sergio Cambra .:: entreCables S.L. ::.
Mariana Pineda 23, 50.018 Zaragoza
T) 902 021 404 F) 976 52 98 07 E) [email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" 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/activescaffold?hl=en.

Reply via email to