Re: Slow performance

matthibcn
Sat, 31 Mar 2007 17:38:47 -0000

Just for curiosity, what the hell will you do with 5000 recipes in ONE
page ??

Use the limit option set to 20 at most, then use pagination and stuff to
get more recipes...

Lemme see the page with 5000 recipes, just wonder about the usability

Regards

matthi

Nik schrieb:
> Hello all, I found a strange dilemma here:
>
> I have a table of several thousand rows and I experimented with these
> two method to display them:
>
> In this first method, I just put the follow in the view, let''s
call
> the view, display.rhtml
> <% for x in Cookbook.find(:all) %>
> <%= x.recipe %>
> <% end %>
> The page displays all 5000 recipes in less than 2 seconds. I am quite
> happy with it.
>
> The second method, I put the find() business in the controller within
> a render :update do |page|.
>
> def showrecipe
>    render :update do |page|
>      page.replace_html ''displaydiv'', :partial =>
''recipe'', :collection
> => find(:all, conditions => ["cuisine = ?",
"italian"])
>  end
> end
>
> This method, when called, takes forever.
>
> ----> Can anyone be kind enough to hint why this is the case? <--
>
> Thank You!
>
>
> >