Displaying 20 results from an estimated 3000 matches similar to: "how to paginate child records"
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:
2006 Apr 27
5
def list - paginate question
How do I adapt this code to only list articles made by the user logged
into the session?
def list
@article_pages, @article = paginate :articles, :per_page => 10
end
--
Posted via http://www.ruby-forum.com/.
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/.
2009 Aug 18
4
pagination problem....
Hi,
please help...
In controller...
def index
@customers = Customer.find(:all)
pagination code here....
end
In index.html.erb
Displayes list of customers and has pagination 1,2,3,4...etc.
On clicking page 2, it will again run this(Customer.find(:all)) query in
controller. So, there will be lack of performance.
So, how to increase the mysql performace? Can i use the index as below
or any
2006 May 22
4
use join table in paginate
How come I allways immediately run into difficult stuff when I''m trying
some new programming language? Am I blind for the simplicity of
Ruby/Rail, which a see must be there? Anyway, don''t try and answer this
rhetoric question. I have got another one for you, seemingly difficult.
I''m struggling with a n:m relationship (in a database, that is) and its
join table.
2006 Jun 10
1
paginate session problem.. (syntax question)
I have this code in my controller and i cannot seem to figure out how to get
it to paginate correctly.. Is there a trick to do something like this?
There are a few others at www.rubyonrailsforum.com that are having the same
issue. Any insite would be great, thanks in advance!
def display_location
if params[:search] && params[:search].size > 0
@listing_pages, @listings =
2006 Feb 16
1
Pagination help/how to
Hello,
I want to know how can I paginate a set of records. It seems
there is no direct way of doing this, and I am not able to understand the
documentation of paginate, so any pointers on how to do this will be much
appreciated.
To be specific what I want is that the records returned by user.recipes, the
recipes of the particular user be paginated.
My attempt to do this failed because
2008 Feb 29
7
Moving pagination to the Model
I''m using will_paginate in a Post class method;
[code]def self.list(page)
paginate :per_page => 10,
:page => page,
:include => :user
end[/code]
I can happily use the method on my posts controller index action;
[code]
class PostsController < ApplicationController
def index
@posts = Post.list(params[:page])
respond_to do |format|
2006 Jun 14
4
Using now() to determine what should be displayed
I''m trying to create a paginated list that will take note of the
"end_date" field in my table. This is what I have:
@post_pages, @posts = paginate(:posts, :per_page => 10, :order_by =>
''end_date'')
in the controller. And for the view:
<h1>Posts ending soon</h1>
<ul><% for post in @posts do %>
<strong>Post Title:
2006 Feb 13
1
another simple question: per_page in pagination
Hi,
Why can''t I use a variable to specify the :per_page attribute when using
the most basic form of pagination? (if I use a hardcode number, it
runs) What did I do? Thx.
My code:
def list_orders
page_size = 20
...
order_pages, @orders = paginate(:orders, :per_page => page_size)
end
My Errors:
undefined method `>'' for false:FalseClass
RAILS_ROOT:
2006 May 23
3
Pagination problem
hi everybody,
i am new to rails..
plz clear my doubt...
this is my question
In my table(public_topics), i have 11 rows of data..
whenever i run the following view, it shows the entire rows in the
current page..
and i have set the '':per_page'' option to ''2''.so it must show two data
per page..but it shows all the rows in a single page..and this case
continue
2006 Apr 12
1
how do i paginate the results of a query?
I have a controller and list page for region object. My list page has a
''name'' text input that can be used to limit the list.
It works except that the paginate gets the full set of regions unqualified
by my search term. I believe this full list is contained in :regions symbol
which I dont seem to be allowed to modify or replace (yes I am a ruby and
rails newb). How can I
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 06
4
"Selecting" a calculated row / Using :select in the paginate method
Hi,
I was trying to use the :select parameter to select a calculated row,
but it appears that the parameter is not picked up by the paginate method.
I want to add the following to the select statement:
timediff(now(), created_on) as age
So I tried:
@story_pages, @stories = paginate :stories, {:per_page => 10, :include
=> ''user'', :select =>
2006 Feb 13
1
Paginate @member.items?
Is there a quick and easy way to paginate something
like @member.items (Member with has_many :items)?
Right now I do in the controller:
@item_pages, @member_items = paginate :item,
:conditions=>["member_id=?", @member.id],
:per_page=>25,
:order=>''datetime desc''
It''d be more DRY if this was possible:
@item_pages, @member_items = paginate
2006 Mar 01
2
Problem with paginate search
Hi,
Firts all sorry for my poor english
I am doing a simple search with paginate, the problem is the search dont
find the words within acutes (example "dont find sal?n if i search salon").
Its the code for the seach:
def search
words = @params[''search''].to_s.split('' '')
array_conditions = []
for w in words
array_conditions =
2006 Aug 14
5
Tutorial for Queries
Hi! I''m looking for a good tutorial that explains the main points of
performing queries with Rails. I do have AWDWR and have read the
section on ''find'' but I''m looking for something that goes into more
detail on how to perform queries across tables.
Abstracted from my current application, this is an example:
* person has_many sites
* site has_one room
*
2006 May 07
4
Paginate() from multiple tables
Hi
I''m wondering if there''s a way I can gather data from multiple tables
from the child table by using the paginate method?
I would have done it using select_by_sql but I need it to paginate.
My table structure is:
Records is a child of Date and Account
Date Account
| |
^ ^
Records
I want to be able to print a table using the Records controller that
will
2008 Mar 31
10
Paginate with Rails 2.0.2 question
Hi,
So I''m using @post_pages, @posts = paginate :posts, :per_page => 10
to paginate.
But I have rails 2.0.2 on my VPS. Now this version of paginate throws
an error. What happened to classic pagination and what is done now?
Thanks,
Ron
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on
2006 Apr 07
2
Paginate single items
Hi,
In my blog i display a post. I want to display a link tot he previous
post if there is 1 and a link tot he next post if there is one.
So i have in my controller
def post
@post = Post.find(params[:id])
@post_pages, @posts = paginate :posts, :per_page => 1
render(:layout => false)
end
And the following code in post.rhtml
<% if @post_pages.current.next %>
<%=