similar to: Paginate do a Count(*) request before...

Displaying 20 results from an estimated 100 matches similar to: "Paginate do a Count(*) request before..."

2005 Dec 29
4
Paginate do a Count(*) request before, how access that count value.
Hello, AV::paginate query first by a count, how access this value in the controller or view ? Why ? Because I''ll like to display the total number or records found w/o doing another expenssive Count. Thanks,
2006 Jan 06
1
Re: Rails Digest, Vol 16, Issue 132
This page should be helpful on pagination: http://wiki.rubyonrails.com/rails/pages/HowtoPagination Also, I don''t totally understand your model but I think you maybe making the SQL harder than you need. find_by_sql feels like overkill in this case. Either a simple find with conditions or something like "user.color.name" might do the trick for you. Kevin
2005 Dec 13
0
Splitting records into multiple columns (can this code be improved?)
I have an array of categories, and I wanted them split up into two columns in tables: category item_count | category item_count category item_count | category item_count category item_count | category item_count category item_count | category item_count ... Here''s the template code: <table> <tr valign="top"> <td width="50%"> <table
2007 Oct 30
2
How to switch off accepting the shortcut of column names
Dear R-users, currently I am working with the R version 2.4.1. I realized it has a feature, which might be wonderful (as so many things in R), but in this case might be a bit dangerous as well. It seems that columns of a data frame can be called just by indicating the first letter of the name of the column. For example: first_item <- seq(1,10) second_item <- seq(11,20) dat <-
2005 Dec 29
0
strange output in http header
Hi there, I''m experiencing something strange in rails http headers. The response comes back as text/plain. The http header looks like this: HTTP/1.1 200 OK Date: Thu, 29 Dec 2005 15:18:18 GMT Server: Apache/2.0.54 (Debian GNU/Linux) PHP/4.3.10-16 mod_ruby/1.2.4 Ruby/1.8.4(2005-10-29) #<#<Class: 0x40a7f818>:0x40a7f778>Content-Type: text/html Cache-Control: no-cache
2006 Jan 31
6
Pagination - why is it this hard?
Hi everyone, I''m at the end of my rope on this. I can''t get pagination to work with anything but a standard find on a model. If I try to do a search and customize the pagination, I get lots of different variations. My thought was to have the list action do what it does, but to pass it a list of search conditions from the search action. So, if search determines that we need
2006 Jul 19
3
render :partial inserting new line in RJS
Struggling a bit with rendering a partial in an RJS template. I''m having to feed the javascript directly to the page object as couldn''t find a way to have insert_html work directly on the proxy object returned by select. However, that''s not the problem. The code for doing that is below and it all works fine, except that a new line is being inserted after the
2006 Jan 10
1
Can somebody explain when to reload an ActiveRecord
Hi all, I''ve the following test method in my controller_test which increment the ''qty'' attribute in a has_many association, ''sa_report_products''. The ''item_count'' method returns the sum of all qty''s in ''sa_report_products'': def test_add_product_to_report sa_rpt = SaReport.find(1) assert_equal 3,
2007 Jun 20
1
Count_by_content ??
Is there a count_by_content alternative to the find_by_content action? This is because I''m wanting to do the following in my pagination method: def list # step 1: set the variables you''ll need page = (params[:page] ||= 1).to_i items_per_page = 20 offset = (page - 1) * items_per_page # step 2: instead of performing a find, just get a count item_count =
2006 Apr 06
6
pagination question
i''ve figured out how to use the next and previous links with the paginator class but now i''m trying to figure out how to display all the page numbers in between. looking through the rails api, i found paginator.each() but i''m not sure how to use it, or if that''s even what i am looking for. also, is there a way to limit the amount of pages like some sites
2006 Jun 07
3
Pagination
Does anyone know if there''s a plugin to do pagination numbers like: Prev 1 2 3 4 5 etc Next And automatically move through the pages? Thanks. -- Posted via http://www.ruby-forum.com/.
2015 Oct 07
0
brass and chert compiled / xapian port to Interix
Report by Eric Lindblad 06-10-2015 http://www.ericlindblad.blogspot.com cf: http://permalink.gmane.org/gmane.comp.search.xapian.general/9885 modifications allowing for brass and chert to compile on SFU Interix 3.5 (modified) [code change not performance critical] /xapian-core-1.2.21/backends/brass/brass_check.cc /xapian-core-1.2.21/backends/chert/chert_check.cc #include <climits> +
2005 Dec 16
13
How to pass a collection to paginate?
There must be a better way to write this code: @project_pages, @projects= paginate :project, :per_page => 10, :conditions => ["account_id = ?", account] ?! If only I could pass the sub-collection account = ... @projects = account.project to paginate, instead of letting it extract it with a find :all + sql conditions Alain. -- Posted via
2006 Jan 24
1
Pagination
Hello, maybe that I''m a stupid, but I don''t know how I can working with pagination. In all examples is written (for example) next: def user_list @user_pages, @users = paginate(:users, :order_by => ''name'') end So, it''s OK (as a scaffold) for all set of users. But I need a little other functionality. For example I need paginate only a little bit
2006 Feb 23
6
Search Forms with Pagination
Hi there everyone, I''ve recently moved to RoR and am still struggling with the basics of what used to be second nature in php, so on with my question: I have a database with products, and I need to create a search form that paginates the results. What I have so far in my controller is: def list # If the values are nil, then set them, otherwise wrap them in % # Also,
2006 Mar 21
2
Rails newbie can''t initialize a new Paginator object
Hi all, I''m using ruby 1.8.2-15 and a recent rails 1.0 download. I''m trying to implement the Classic/Custom pagination in a list action. Here''s my code: def list getSearchTerms # NOTE: @params[:search_results] is an Array of product_data objects # returned by a search action. @results = @params[:search_results] if @results.nil? then # The default
2005 Dec 19
6
custom find methods and pagination
i''ve got several methods in my models i use to find based on certain criteria...i''ve done this so the controller code is less cluttered, plus the DRY factor. example: class Foo < ActiveRecord::Base def find_by_something(something) find :all, :joins => ..., :conditions => ... end def find_by_something_else(something_else) find :all, :joins => ...,
2020 May 18
4
how does autofs deal with stuck NFS mounts and suspending to RAM?
Hi, after trying sshfs to mount a remote file system on a server with the result that sshfs will sooner or later get stuck and require a reboot of the client, I'm fed up with it and am looking for alternatives. So next I would like to use NFS over a VPN connection instead. To minimize the instances of the NFS mount getting stuck, it might be helpful to use autofs. What happens when the
2018 Dec 06
3
Build error while upgrading samba 4.9.3
Hi Team, Trying to upgrade samba 4.9.3 on debian wheezy. while building facing the following error. Build phase! ` Configuring Samba 4 - x86_64 Checking for program gcc or cc : /usr/bin/gcc Checking for program cpp : not found Checking for program ar : /usr/bin/ar Checking for program ranlib : /usr/bin/ranlib Checking for gcc
2007 Sep 11
0
How to test ''Paginate''?
Great Hi to everyone: I don''t know how to write spec for a controller method which has ''paginate''. Is there any Rspec API for it? To illustrate, I would like to post an example. class PeopleController def paginate_method hash = Hash.new hash[:people_page], hash[:people] = paginate :people, ...#order and conditions omitted render