Hi all, I have to put serial numbers but in pagination. If in my coding i put loop like <% i=1 @products.each do |product| i = i+1 %> ...... <td>serial number</td> <td><%= i %></td> ....... It displays number from 1 to 9 but when i go to second page it again displays numbers from 1 to so..... on. I need serial numbers 1 to so on..... on all the pages. Any help would be greatly appreciated. Thanks, Rucihta. -- 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 -~----------~----~----~----~------~----~------~--~---
Check out this post.. http://www.railsforum.com/viewtopic.php?pid=490 -- 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 -~----------~----~----~----~------~----~------~--~---
Ratnavel Sundaramurthi wrote:> Check out this post.. > > http://www.railsforum.com/viewtopic.php?pid=490Yeah... I have checked this link. But this doesn''t fulfill my requirement. I want the serial numbers against my products but they are not coming correct on the second page. -- 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 26 Dec 2007, at 07:56, Ruchita Sharma wrote:> > Hi all, > > I have to put serial numbers but in pagination. If in my coding i put > loop like > <% i=1 > @products.each do |product| > i = i+1 > %> > ...... > <td>serial number</td> > <td><%= i %></td> > ....... > It displays number from 1 to 9 but when i go to second page it again > displays numbers from 1 to so..... on. > I need serial numbers 1 to so on..... on all the pages.Surely a product''s serial number should be an attribute of product and not something you''ve conjured up in the view? That said if pages is your paginator, something like pages.current_page.offset tells you how many have been skipped. 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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> On 26 Dec 2007, at 07:56, Ruchita Sharma wrote: > >> <td>serial number</td> >> <td><%= i %></td> >> ....... >> It displays number from 1 to 9 but when i go to second page it again >> displays numbers from 1 to so..... on. >> I need serial numbers 1 to so on..... on all the pages. > > Surely a product''s serial number should be an attribute of product and > not something you''ve conjured up in the view? > That said if pages is your paginator, something like > pages.current_page.offset tells you how many have been skipped. > > FredHi, Product serial number is not in products table. In products table i have an id which is auto incremented, but i need a serial number in the view to display how many products have been added. If i take product id and display it then it won''t serve the purpose because it is auto incremented and if i delete the products it wont display correct serial numbers. Thanks, Ruchita. -- 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 -~----------~----~----~----~------~----~------~--~---
Hi, I want product serial number in my view. If i put the code <% 1 = 1 @products.each do |product| %> <% i=i+1%> <td>serial number</td> <td><%= i %></td> It displays number from 1 to 9 but when i go to second page it again displays numbers from 1 to 9 . I need serial numbers 1 to so on..... on all the pages. Any help would be greatly appreciated. Thanks, Ruchita. -- 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 -~----------~----~----~----~------~----~------~--~---
Hi, Am writing this code to get serial numbers along with the products.... On each page 5 products are displayed. <% 1 = 1 @products.each do |product| %> <% i=i+1%> <% if @product_pages.page_count > 1 %> <%= i+5%> <% else %> <% i %> <% end %> But its is displaying serial numbers like 6,7,8,9,10 and again 6,7..... -- 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 -~----------~----~----~----~------~----~------~--~---
Hi, Can you use i = product_pages.page_count* 5 + i, maybe that will help. atul -- 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 -~----------~----~----~----~------~----~------~--~---
Its not working. Please tell me some other option. -- 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 12/28/07, Ruchita Sharma <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Its not working. Please tell me some other option.One option you might consider is to provide some context. Not everyone here reads the web forum, so we have no clue what exactly is not working for you. -- Greg Donald http://destiney.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 -~----------~----~----~----~------~----~------~--~---