Hi all,

In my controller
def index
 @customers = Customer.find(:all)
 @size = @customers.size
 @total_pages  = (@customers.size / $PER_PAGE.to_f).ceil
end

In index.html.erb
Displays a customer list with pagination(Example: 1,2,3,4,5....)

On each page number click (Example: 1,2,3,4,5...) - the below code in
index function gets executed.

@customers = Customer.find(:all)
@size = @customers.size
@total_pages  = (@customers.size / $PER_PAGE.to_f).ceil

This results in performace lack.

So I want to read the db records only once and store it in some
variable.
And i will use that variable to display the records for 2,3,4,5 pages.

Please note: I don't want to use any plugins and please help to
implement..
-- 
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to