Topic: Pagination related question...
I have the following code in my controller:
@total_device_number = Device.find(:all)
@page_title = 'Listing Devices'
sort_by = params[:sort_by]
@device_pages, @devices = paginate :devices,
:order => sort_by,
:per_page => 20
In list.rhtml, I have a line of code that fetches the total no: of devices in the db:
<%= @total_device_number.size %>
When I attempt the following in list.rhtml instead,
<%= @devices.size %>
I end up getting the number of devices for a particular page...maximum of twenty obviously. Is there a way for me to get rid of the @total_device_number instance variable, and instead use the @devices instance variable to get a comprehensive listing? Thank you very much for you time.
It's not the size of the app that matters, it's how you code it. ~ railsenvy