Displaying 20 results from an estimated 3000 matches similar to: "Pagination of Complex Queries"
2006 Apr 13
7
Complex SQL in paginate command?
Hi all,
Is there a way to create pagination with a complex SQL, more complex
than the :conditions option will support?
I have two databases, houses and images. Houses has_many images, and
each Image belongs_to house.
I''m creating a search engine for the house records and I''d like to be
able to filter out all the houses without any associated images.
So far I''m
2007 May 10
5
Pagination has many through problems
I have searched for days for an example that demonstrates what i would
like to do, and this morning i thought i''d worked it out, but
no....here''s what i have:
Controller
==========
class ProfilesController < ApplicationController
def friends
current_user.profile.friends
end
def list_friends
@profile_pages, @profiles = paginate( friends, :per_page => 10)
end
end
2006 Jun 21
7
acts_as_taggable and paginate?
Hi there,
I''ve been trying to paginate over a list of members that all share a tag in
common using the acts_as_taggable plugin. The regular way of paginating over
a collection doesn''t seem to work with acts_as_taggable. Here''s what my
method looks like that takes in a tag name, finds all the members that share
the tag and then displays all the members. Nothing too fancy
2006 Apr 10
9
Pagination with letter (A B C D ... Z)
Hi there,
Is there a neat and easy way to implement pagination with letters
rather than numbers eg :
A B C D ... Z
Rob
2006 Mar 31
4
Question about pagination
Hi!
I''ve got a list of project on the main page and if one of them is
selected i render a partial using ajax with data of selected project.
How to create links to next/previous project using pagination?
--
Posted via http://www.ruby-forum.com/.
2006 Jul 16
3
pagination over custom-sorted collections?
I have a little web app where we need to paginate collections of
items. I''m trying to sort the collection and then pass it, sorted, to
a Paginator, and still be able to paginate through the collection,
across several pages, with the new sort order. The only thing I''m
doing differently from the regular scaffolding approach is this:
@order_pages = Paginator.new(self,
2006 Mar 31
7
problem with habtm conditions in pagination
Hello list,
I''ve had this problem for two days now. Perhaps someone here would
care to comment on it. I''d be REALLY appreciative if that''d be the case.
Basically, it''s outlined at this paste: http://rafb.net/paste/results/
kXQSHZ83.html
But I''ll paste it here, too.
The main problem is in the customers/list action. The problem is with
this line:
2005 Sep 21
0
Basic pagination question
Hi there
I have a class method defined in my Product Model, ''featured_items'',
which returns a recordset from the products table based on certain
find conditions.
I simply want to paginate this recordset, not the whole products
table, using the paginate helper.
After reading the Rails docs, I''m still struggling to work out how, in
my ''list'' view, to
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 Apr 18
1
Pagination links with separator
Hi,
I have @result_pages and @results obtained from paginate in an action. I
want to show the pages as
1 | 2 | 3 | 4 >
The fifth page will show:
< 5 | 6 | 7 | 8 >
and so on.
How exactly do I render the paginator to give this effect? I guess I
will have to use pagination_links_each. But being new to Rails, I need
help.
Thanks,
Yash
--
Posted via http://www.ruby-forum.com/.
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 => ...,
2006 Jul 25
6
form and pagination question
Hello,
How do I get params from a form to use with a paginator?
debug(params) shows this
city: !map:HashWithIndifferentAccess
id: "1"
but in my controller, when I try to use
@hotel_pages = Paginator.new self, Hotel.count(:conditions =>
"hotels.city_id = params[:city][:id]"), 3, @params[''page'']
it doesn''t work. I suppose it''s a simple
2007 Apr 04
2
[PLUGIN] ArPaginator - Allows you to easily paginate over any existing AR queries.
The built-in Rails pagination is fairly limited...you pass in the
model name, and optionally some conditions, and it generates a
paginated query for you. This gets to be very bad if you''ve got any
custom queries.
class Company < ActiveRecord::Base
def complete_videos
Video.find :all, :conditions => "company_id=#{id} AND
status=''complete''", :order
2006 May 01
12
pagination in acts_as_ferret
I''m just wondering where I would put the pagination for search results
when using "acts_as_ferret".
At the moment my search code is..
def search
@query = params[:query] || ''''
unless @query.blank?
@results = Tutorial.find_by_contents @query
end
end
Cheers
SchmakO
--
Posted via http://www.ruby-forum.com/.
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 Jan 10
1
sql server & linux: left join problem
I''ve got a left join problem of some sort connecting from linux
FreeTDS/ODBC to SQL Server. It''s similar to the false post I had
earlier, but this is a real problem. Here''s my code:
def find_recipes_for_workorder
@recipe_pages, @recipes = paginate_with_sort :recipes, :per_page
=> 10, \
:joins => ''left join workorder on
2006 May 19
1
acts_as_taggable pagination
Im using the acts_as_taggable plugin, is there a way to paginate the
find_tagged_with results?
--
Posted via http://www.ruby-forum.com/.
2006 Jul 31
9
Multiple Pagination
I have the following:
def index
begin
@restaurant_pages, @restaurants = paginate :restaurants,
:order => (params[
:sort ] || "name"),
:per_page => 2
@cuisines = Cuisine.find_all
rescue
redirect_to :action => :index
end
end
# sort by cuisine
def
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 30
9
error when adding a new table to the existing application
Deniz wrote:
> Hi Everybody,
> I am a newbie in this list so please forgive me if this is a lengthy
> message.
> Currently I am working on a project at my work place that includes
> viewing some oracle tables(I do not have control over to rewrite the
> tables) and searching the tables based on a given criteria with Rails.
> Up untill now everything was working great. The