similar to: Paginate() from multiple tables

Displaying 20 results from an estimated 2000 matches similar to: "Paginate() from multiple tables"

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 Jan 19
4
A simple scaffolding question
All, When I generate scaffolding on my model, it doesn''t display all the fields in the create and edit views. It populates the views with text/char and date types, but omits any integer fields. Is this normal behavior or a bug? Thanks! -Nick
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 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/.
2006 Jan 06
4
"Selecting" a calculated row / Using :select in the paginate method
Hi, I was trying to use the :select parameter to select a calculated row, but it appears that the parameter is not picked up by the paginate method. I want to add the following to the select statement: timediff(now(), created_on) as age So I tried: @story_pages, @stories = paginate :stories, {:per_page => 10, :include => ''user'', :select =>
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/.
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 Mar 01
2
Problem with paginate search
Hi, Firts all sorry for my poor english I am doing a simple search with paginate, the problem is the search dont find the words within acutes (example "dont find sal?n if i search salon"). Its the code for the seach: def search words = @params[''search''].to_s.split('' '') array_conditions = [] for w in words array_conditions =
2012 May 22
4
undefined method `paginate'
I am working with Railsspace social networking book. I stuck in the problem when i am doing paginate for the search result. It gives the following error. NoMethodError in CommunityController#index undefined method `paginate'' for #<CommunityController:0x57436f0> My Controller Index page coding is below def index @title = "Community" @letters =
2006 Dec 18
2
Find, paginate, conditions and associations
Hi, I''m trying to figure out how to use paginate when one of the conditions depends on the association between one model and another. For example: I have a model Authors which has_many Posts. I would like to find all the authors and order them by the number of posts that they have published and then paginate those results. What if I wanted to base the paginate condition on all the
2006 Apr 13
7
Complex SQL in paginate command?
Hi all, Is there a way to create pagination with a complex SQL, more complex than the :conditions option will support? I have two databases, houses and images. Houses has_many images, and each Image belongs_to house. I''m creating a search engine for the house records and I''d like to be able to filter out all the houses without any associated images. So far I''m
2006 Jun 10
1
paginate session problem.. (syntax question)
I have this code in my controller and i cannot seem to figure out how to get it to paginate correctly.. Is there a trick to do something like this? There are a few others at www.rubyonrailsforum.com that are having the same issue. Any insite would be great, thanks in advance! def display_location if params[:search] && params[:search].size > 0 @listing_pages, @listings =
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 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 02
6
Paginate with joins messing with id
Hi all, Best wishes for the new year! :'') I''m very new to Ruby and Rails, and I ran into a problem with the "paginate" function. When I use the following method to get a number of forum topics based on a category name passed via the URI: @topic_pages, @topics = paginate :topics, :joins => "INNER JOIN categories ON
2013 Oct 24
6
undefined method `paginate' for #<Class:0x567eb98> in Rails Tutorial
Hi, I''m getting a undefined method `paginate'' for #<Class:0x567eb98> even though I have gem ''will_paginate'' installed. Inside the users_controller I have @users = User.paginate(page: params[:page ]) so I believe I set everything up to be correct. Can you figure out why the method''s undefined, despite installing the gem? -- You received this
2006 May 14
3
Beginner question on paginate with params and conditions
I am trying to do a simple search by product name. The first page returns fine, but when I try to go to any other pages of the search results, I lose the original search parameters from my search form and get NilClass errors. Here is the code in my controller: namesearch = "%" + params[:name].strip + "%" @product_pages, @products = paginate :product,
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 Feb 28
5
Problem with paginate, include and foreign keys
Hi all, Solaris 10 Ruby 1.8.4 Rails 1.0.0 Postgres 8.1 postgres driver 0.7.1 I''m having a problem with getting paginate() to properly pick up an FK constraint properly. I don''t seem to have this issue with ActiveRecord, however. Consider: create table start_dates ( id bigserial, start_date date unique, max_slots int default 40, primary key (id) ); create
2008 Mar 31
10
Paginate with Rails 2.0.2 question
Hi, So I''m using @post_pages, @posts = paginate :posts, :per_page => 10 to paginate. But I have rails 2.0.2 on my VPS. Now this version of paginate throws an error. What happened to classic pagination and what is done now? Thanks, Ron --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on