Displaying 20 results from an estimated 3000 matches similar to: "Beginner question on paginate with params and conditions"
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:
___________________________________________
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 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 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 Jan 19
8
Pagination_links without "?page=" but with params[:id]
Hello,
With default pagination I have this :
<a href="/users/infos/3?page=1">1</a>
<a href="/users/infos/3?page=3">3</a>
but i need this :
<a href="/users/infos/1">1</a>
<a href="/users/infos/3">3</a>
I need to remove the "?page=" parameters and rewrite a little the link ( with a link_to ? )
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 Jan 28
8
how to pass search parameters to pagination links
I have a search page with a text_field as below
<%= text_field ''program'', ''program_name'' %>
After I perform the search in my controller I go to a search results
view which shows search results and uses Rails pagination. Now how to
pass the search paramters (i.e. params[:program][:program_name] in my
controller) to the pagination links (next and
2006 May 07
5
File upload/database import
I have been using Ruby on Rails for around 6 weeks now (so far I love
it), but I''ve gotten to a point in the application where I need to allow
the user to upload comma deliminated text files that will get loaded
into one of the database tables.
Before I get started doing this, I was wondering anyone knows of any
examples or tutorials that deal with this. I''d rather do it
2006 Apr 19
2
Beginner problem with foreign keys
Hi, I''ve been trying to get this to work all night. I''ve made some
progress by reading other posts, but I''m stuck now and can''t figure out
what I am doing wrong.
I have two tables: application_users and user_types. In my
application_users table I have a field named "user_type_id". At first,
I thought if I set up the foreign key with the correct
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 Apr 22
7
Expiring items
In my database I have a products table that has a bunch of attributes
(title, description, etc) including one for date_expires.
Is there a best practices method to get the database to erase the
expired items? Is that done outside RoR via Cron or something?
Else is it better to just have my app filter out anything that is
expired but still keep those records in my dbase?
--
Posted via
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 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 Aug 03
2
pagination with customer list.rhtml
(To preface this - you can just imagine I am making the cookbook from
the Rolling with Ruby on Rails tutorial)
I have made a customer list view (list.rhtml), so that I could include
attributes from multiple database tables. This works fine, however, the
list page no longer paginates (i.e. does limit the item list to 10 items
at a time, with a 1, 2, 3... links at the bottom)
I am trying to
2006 Jan 04
7
wrong number of arguments error
I keep getting this error every time I try to pass a value to a method.
Here is a sample nonworking method. I''ve been pulling my hair out over
this all night! Why won''t it work!?
My url path is :3000/store/browse/shoes and I''m getting this in the log
Parameters: {"action"=>"browse", "id"=>"shoes",
2006 Jul 23
2
pagination_links and friendly urls
my pagination_links seems to auto generate the links using the current
controller, action and id. The page they''re appearing on however have a
friendly url I have created. I want to be able to make pagination urls
generated by pagination_links "user friendly" as well so that they match
my current naming convention.....i know there must be a way to do
this....any ideas?
2006 May 09
1
Beginner questions on attributes and arrays
Hello,
I am trying to do something and I''ve been reading my Agile Web
Development with Rails book and doing internet searches for several
hours now and I have made no progress.
Here''s the issue: I have a table of sales reps that is linked to a
table of territories. There are around a thousand territories that are
numbered and each sales reps has many territories. I will
2006 Mar 13
1
Styling pagination links ?
Hello,
How to style the pagination links ?
I simply try to set the number of the current page to another color. But
I have the "..." also colored.
Paginator have options to style ?
Thanks
2006 Feb 23
6
Search Forms with Pagination
Hi there everyone, I''ve recently moved to RoR and am still struggling
with the basics of what used to be second nature in php, so on with
my question:
I have a database with products, and I need to create a search form
that paginates the results. What I have so far in my controller is:
def list
# If the values are nil, then set them, otherwise wrap them in %
# Also,
2005 Dec 19
1
<% unless params[:context] == :gallery -%> question
I have a template that is called by two different methods. I only want
part of it too show up when it is called from one of the methods. It
always shows up for me. Can someone help to point out my error? Below
is the method that should keep part of the tempate from printing, and
the relevent part of the template.
method:
def gallery
@product_pages,@products = paginate(:products,