Displaying 20 results from an estimated 5000 matches similar to: "Simple question about :list method in scaffolds"
2005 Sep 18
5
NameError: uninitialized constant Addres
I created some scaffolding for an Address model and an Addresses controller.
When running the functional tests for the addresses controller, I get
this exception: "NameError: uninitialized constant Addres"
The exception seems to start from this function:
def list
@address_pages, @addresses = paginate :address, :per_page => 10
end
I''m guessing pluralization bug?
2006 Apr 19
4
Another DRY question
I have some code working that lists only items from a particular user.
The code in my list action finds the user and then conditionally lists
only his/her items:
def list
user = User.find(session[:user])
user_id = user.id
@product_pages, @products = paginate :products, :per_page => 10,
:conditions =>[''user_id = ?'',
user.id]
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/.
2008 Nov 27
7
will_paginate issue
Hi,
I am trying paginate (will_paginate) users posts. It is counting and
showing the page links correctly, but still showing all the posts on one
page.
@entries = @user.entries.paginate :per_page => 5, :page =>
params[:page], :order => ''created_at DESC''
If I change it to @entries = Entry.paginate :per_page => 5 ........
It is fine, but I would like to show only
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''
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 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 Jan 06
2
Paginate from a difficult sql query
Hello,
I have 2 tables
table colors :
+----------------------+
| id | user_id | name |
+----------------------+
| 1 | 1 | test1 |
| 2 | 2 | test2 |
| 3 | 3 | test3 |
+----------------------+
table users :
+----------------------+
| id | enabled | name |
+----------------------+
| 1 | 1 | bob |
| 2 | 1
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 Jul 05
3
list of users
Hi all,
I''m creating admin module. in that module i need to get the list of
users and also the projects created by the each user.
No doubt i''m getting the list of users. but i''m not getting the list
of projects done by each user..
This is my code::
<% for user in @users %>
<%=link_to
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 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 Apr 19
2
Filtering items within scaffold
I''m messing with the agiles store example. I added a field in my
product table (user_id) that is also a foreign key relationship via
fk_products_user
In my scaffold I''d like to list the products as usual, but only those
products from the logged in user. I assume that would be done in the
controller..
How would I extend the basic controller:
def list
@product_pages,
2006 May 23
5
Wierd pagination problem - Unknown options: order?
I am trying to use pagination with the order option. I am following
examples I''ve seen all over the web, but I am getting an error. My code
seems simple:
def list
@upload_pages, @uploads = paginate :uploads, :per_page => 20, :order
=> ''id''
end
Yet I keep getting this error:
___________________________________________
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
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 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 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 Jan 25
6
cant convert integer to string
I''ve experimented around and have ran out of ideas, here''s the message:
TypeError in True_false_questions#list
can''t convert String into Integer
RAILS_ROOT: script/../config/..
Application Trace <http://zbyte32:3000/true_false_questions/list/0#> |
Framework
Trace <http://zbyte32:3000/true_false_questions/list/0#> | Full