Displaying 20 results from an estimated 4000 matches similar to: "Confused by this error when trying to use ''pagination''"
2006 Aug 12
0
Help needed in specifying conditions in pagination
Hi,
In a controller, I add to the default list action a condition, thus:
def list
@user_pages, @users = paginate :users,
:conditions => @query,
:per_page => 10
end
and @query is defined somewhere in the controller as
@query = "user_name like ''%Smith%''"
where user_name is an attribute of User.
Result: The condition pulls out the whole table,
2006 Feb 27
0
Simple Namespace Question
I put the following code into my application_helper.rb file, which will
allow super fancy ajax pagination blah blah blah.
Now the problem is, it''s not being identified.
I''m running Rails 1.0.0, and froze edge, so it''s sitting in /vendor.
The actual pagination_helper.rb file is appropriately sitting in:
/vendor/rails/actionpack/lib/action_view/helpers
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
2005 Aug 04
1
Pagination and :include (eager associations)
I have tried to use eager association with pagination, but
the :include option is not supported:
Here''s the one-line pagination call without :include
@link_pages, @links = paginate :link, :per_page => 10, :order_by
=> sort_clause
and here the work around, using the "classic" method
# @link_pages = Paginator.new self, Link.count, 10,
2006 Jan 03
0
has_and_belongs_to_many include problem
hey,
i have users who are in groups, and i have a search form, where i can search on
group, user lastname, and user firstname.
All this is also with pagination.
these are my models
class User < ActiveRecord::Base
has_and_belongs_to_many :groups
end
class Group < ActiveRecord::Base
has_and_belongs_to_many :users
end
in my controller i do this
THIS works (but in need pagination)
@users2
2006 Apr 26
1
List shows always first page
Hello!
I''m a beginner of rails.
I made a simple test project with rails 1.1.2 and ruby 1.8.2 on Windows
XP.
DB is SQLServer 7.0.
I''m connecting the server thru ODBC.
I created a table named "users" with about 10 columns.
I inserted 1000 sample records.
I created a scaffold for user model and login controller for it using
the script.
Everything''s fine
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 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:
2008 Mar 06
1
pagination for an object array
def show_details
@sd_ticket = ServiceDeskTicket.find(params[:id])
@servicedesk_cis = @sd_ticket.service_desk_cis
end
What I need is a pagination for @servicedesk_cis using the custom
pagination..How can i give offset and limit to this?
I have successfully done previously custom pagination in another def as
below
def search_sd_ticket
@search_sd_ui_hash=params[:sd_ticket]
2006 Mar 27
0
update subset of my data
Please can someone put me out of my misery...
I am missing the point here:
I have a table of albums called: dealers
I have a table of images: popp_images
each dealer has 6 popp_images linked by foriegn key: albumid
Each dealer can login using user_engine engine
I restrict viewing for each dealer to their own images by assigning each
dealer their own albumid.
I list their images with:
in my
2006 Jul 31
1
Pagination of Complex Queries
I''ve created a class method in my model called find_filtered. The intent is
that I take various params that the user has submitted, and let the model
build the query and return the AR collection, which is exactly what happens.
However, now I''d like to paginate the recordset. Everything I''ve been able
to find about pagination presumes that you have no pre-existing AR
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 May 10
3
NoMethodError
When I want to see my users, then I get:
-----------------------------------------------------
You have a nil object when you didn''t expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.each
Extracted source (around line #3):
1: <% @page_title = "Spisek uporabnikov" -%>
2: <table>
3: <% for user in @all_users %>
4:
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
2005 Nov 02
1
getting pagination to work on joined tables
As soon as I use Model.find(:all, :include => [...], :limit => 3) I
loose associations and can''t do :conditions on joined tables. I''m not
able to do pagination in such association.
Only solution I came up with is this beast:
# I set up a paginator:
@reos_pages = Paginator.new self,
Reo.count(conds.join('' AND ''),
2006 Apr 06
1
Rendering partials with pagination
I currently have a call to this action, which I''d like to paginate:
def get_words
@catid = params[:category]
@words = Category.find(@catid).words
render :partial => "word_display", :collection => @words
end
As you can see, a word_display partial is rendered for each word.
If I add the pagination call (getting the links object), how can I then
get
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 Aug 01
3
paginate, search, sort with ajax problem
hello I hope somebody can help me figure this out.
found this great tutorial at http://dev.nozav.org/rails_ajax_table.html.
got it working except for one thing.
I can''t seem to make the pagination work. The link_to_remote defined in
the helper is pointing to the wrong url.
I have set up things like so:
defined a search method in de project_controller located in
apps/admin/project.
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 11
1
Has And Belongs To Many and Pagination
I''m struggling with the issue of pagination and many to many
relationships.
I have products and categories (a many to many relationship.)
When I go to a category page, I wish to load all products associated
with that category and have pagination of the products.
@category_products = @category.products gives me all the products
associated with the category however, when I try to