search for: per_pag

Displaying 20 results from an estimated 261 matches for "per_pag".

Did you mean: per_page
2006 Feb 07
11
breaking down a list view
...out how to change the order of a list view and it''s obvious to me that I don''t understand what I get from a simple scaffold to know enough to alter it. If someone would be so kind to tell me what this means ... def list @placment_pages, @placements = paginate :placements, :per_page => 10 end @placement_pages, # I am guessing that this calculates the total pages @placements = paginate :placements, # I am guessing that this calculates # pagination from total placements / # :per_page value :per_page...
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: ___________________________________________ ActionController::ActionControllerError in Data#list Unknown options: order /app/controllers/data_controller.rb:12:in `list'' /home/bclinton/work/eds/script/...
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...
2006 Jan 25
6
cant convert integer to string
...TrueFalseQuestionsController < ApplicationController def index list render :action => ''list'' end def list if params[:id] @true_false_question_pages, @true_false_questions = paginate TrueFalseQuestion.find_all["tests_id = ?"+ params[:id]], :per_page => 10 else @true_false_question_pages, @true_false_questions = paginate :true_false_questions, :per_page => 10 end end basically vist the url: http://zbyte32:3000/true_false_questions/list/0 any suggestions would be much apreciated. Thank you. -------------- next part -----...
2010 Mar 26
4
How to calculate per_page value based on browser window size for will_paginate
def self.per_page 20 end Any suggestion on how I can calculate this value base on the size of the browser window? Thanks -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3...
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 http://www.ruby-forum.co...
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 %> <% for video in @videos %> <td><%= link_to(image_tag...
2006 Feb 08
7
DRY methodology
...repeating myself to having essentially the same list view with multiple sorts? i.e. def list_cl # ordered by clients last name @placement_pages, @placements = paginate( :placements, :include => [:client], :order_by => ''clients.last_name'', :per_page => 14) end def list_fac # ordered by facility @placement_pages, @placements = paginate( :placements, :include => [:facility], :order_by => ''facilities.name'', :per_page => 14) end etc. and then have links at the top of each colum...
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] end So far so good! Now I''d like to create an object an automatically add the user''s id to the user_id field in the product table. I don''t want to keep typ...
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
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| format.html #...
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: </strong><%= post.title %> <strong> Date Ending: </strong><%= po...
2006 Aug 07
4
Problem with Pagination
...ks fine: def query @k2_result_pages, @k2_results = paginate (:k2_results, :conditions => [''e_date >= ? AND e_date <= ?'', ''2006-07-12'', ''2006-08-12''], :per_page => 5, :order_by => ''e_date,name'') end However, if I change it to use the POST parameters in the conditions instead, the pagination fails. It correctly shows that I have 14 records and also shows that there are 3 pages, but when I...
2006 May 14
4
searching on foreing keys
...table people(id,name) owner_id being a foreign key of pet pointing to people name. here it is on the pet controller: @paginator, @pets= paginate(:pets, :conditions =>["name OR owner_id like ?","%"+params[:filter]+"%"], :include =>person,:order_by => @sort_by,:per_page => default_per_page ) it searches great in name but not in owner_id. I mean it searches through people id instead of the person name it''s referring. Any idea how to make it search through the foreign key? thanx in advance Pat
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 @upload_pages, @uploads = paginate(:uploads, :per_page => 20, :order_by => ''...
2007 Jun 14
1
rspec will_paginate
...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 status == "unsolved" conditions = {:status => true} if status == "solved" return Ticket.paginate(:page => page, :per_page => per_page, :conditions => conditions) end describe TicketsController, "handling GET /...
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 sort_by_cuisine begin @restaurant_pages, @restaurants = paginate :restaurants, :conditions => [ "c...
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/.
2012 Feb 23
4
Undefined Method
...xample code in my index class: <%= link_to ''DREAMCAST'', games_path(:console => ''Dreamcast'')%> the above code is repeating for each individual console. Now in my gamescontroller I have the following in my index: def index @games = Game.paginate(:per_page => 4, :page => params[:page]).search(params[:search]) @games = @games.find_by_console(params[:console]) unless params[:console].blank? end The problem I receive is that when I click on the Gaming section of my website I receive the following error message which I assume is to say acti...
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/.