Displaying 20 results from an estimated 10000 matches similar to: "Find with Inheritance"
2007 Jun 14
1
rspec will_paginate
Hi Rspec-Users,
I''m not sure if I am correctly specing my index since I''m using
will_paginate.
params[:filter_by] will filter the paginate list accordingly.
Tickets Controller:
def index
@tickets = Ticket.filter_status_by(params[:filter_by],params[:page])
end
Ticket Model:
def self.filter_status_by(status, page, per_page = 10)
conditions = {:status => false} if
2006 Jun 08
9
find :order =>
Hi,
I have the following find statment
@client_pages, @clients = paginate :clients, :per_page => 20, :order =>
"organisation_id, surname"
currently im ordering by organisation_id however I need to order by the
field in the organisation table organisations.name
how can this be done?
Thanks
Scott
--
Posted via http://www.ruby-forum.com/.
2007 Jan 15
2
Help with with displaying a selected list.
Hello. I call a find_all_by_subject("action") which returns 2 videos
and displays them properly. But when I add @video_pages, @videos =
paginate :videos, :per_page => 10 so I can paginate the videos, it
displays ALL the videos as if I selected list videos. Can someone
please tell me what I am doing wrong? Thank you.
selectaction.rhtml
<table>
<tr>
<% x = 0 %>
2006 May 23
1
Re: Wierd pagination problem - Unknown options:
> Unfortunately I still get the same error. Here is my code now (the
> commented line works):
>
> def list
> @upload_pages, @uploads = paginate(:uploads, :per_page =>
> 20, :order
> => ''id'')
> # @upload_pages, @uploads = paginate(:uploads, :per_page => 20)
> end
You may have an older version, try using the order_by clause
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
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 Feb 01
1
Rails pagination problem
I am having this problem with pagination query in my controller class.
I am using SQL server and following code to create pagination fails,
complains about column name ''program_name'' (which is valid
column/attribute of program)
The error message is:
DBI::DatabaseError: S0022 (207) [Microsoft][ODBC SQL Server
Driver][SQL Server]Invalid column name
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 Aug 07
4
Problem with Pagination
Hi Guys,
I am trying to paginate the results from a search. When I use actual
constants in the search conditions, it works fine:
def query
@k2_result_pages, @k2_results = paginate (:k2_results,
:conditions => [''e_date >= ? AND
e_date <= ?'', ''2006-07-12'', ''2006-08-12''],
2006 Jun 27
1
find (ordering by field in related table)
Hi,
I am using the rails find command as below
@project_pages, @projects = paginate :projects, :per_page => 20,
:conditions => "clients.organisation_id = " +
params[''search''][''organisation_id''],
:joins => ''inner join clients ON clients.id = projects.client_id''
There seems to be a problem with project.id being over written
2006 Nov 08
0
Paginating a fetched resultset problems with next/previous
Im using this paginate function to paginate complex sql queries
http://www.bigbold.com/snippets/posts/show/389, all seems to work fine
but theres one thing, when i hit the next link it show nothing, i mean
it only shows the first page, here is the code im using:
#application.rb-----------------
def paginate_collection(collection, options = {})
default_options = {:per_page => 10, :page
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.
2009 Oct 28
2
mislav-will_paginate(will_paginate)
mislav-will_paginate(will_paginate) doesn''t work after search.
servers_controller.rb
def index
@servers = Server.paginate(:page => params[:page], :per_page => 20,
:order => ''device_id ASC'')
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @servers }
end
end
def search
@servers =
2009 Aug 13
2
ajax with will_paginate problem
i can use <%= link_to_remote("MEMBER LIST",:update => "mcont", :url =>
{:controller => :users, :action => :list }) %> this for user listing and
then it display record i want to do paging on this list file but it is
display one page when i click on second page this will no go to second
my controller
def list
#@images = Image.paginate :page =>
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
2006 Jan 26
1
Simple question about :list method in scaffolds
The automatically generated scaffolds made code like this:
def list
@address_pages, @addresses = paginate :addresses, :per_page => 10
end
which was fine, but I only want to return the logged-in user''s
addresses. So I changed it to:
def list
@address_pages, @addresses = paginate :addresses, :per_page => 10,
:conditions => [''user_id = ?'',
2006 Aug 15
2
Working with user data
I am a Rails newbie and I am trying to build a test site in which users
will have their own sets of data.
I understand how to manipulate shared data very well. Most of the Rails
examples out there seem to deal with such shared data. I am struggling
with the "best practice" method for a user to work with their own data
however (and not be able to view/edit other users''
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 Jul 23
2
how to paginate child records
hi
i know i can do:
@customer_pages, @customers = paginate :customers, :per_page => 8
but these customers have helpdesk calls which are child records. I hoped
i could do something like paginate customers.calls, but dat doesn''t work
what is the best way to get a paginated list of child records?
remco
--
Posted via http://www.ruby-forum.com/.
2008 Apr 23
0
self referential (n-n relationship) belongs many controller
Hi all,
I ve some troubles in my small acpplication (only 2 tables).
I want to follow up tasks but these tasks are linked to others tasks.
So I ve tried to do store the nn relationship in other table called
links
1st table : tasks
columns : id | infos neutral... (as title, description etc ...)
-----------------------------------------------------------------------------------
model :
class