Displaying 20 results from an estimated 4000 matches similar to: "use join table in paginate"
2010 Oct 12
2
STI and :through, not working?
Artist.first.medias returns all medias. Media is an STI. Media can be
video or painting.
How do I return all paintings of an artist? Only paintings, not
videos?
In my Artist model, I tried putting:
has_many :paintings, :through => :medias
In console, I do:
Artist.first.paintings.all
And I get:
ActiveRecord::HasManyThroughSourceAssociationNotFoundError: Could
not find the source
2010 Oct 11
12
Need advice on controller / view
Need some advice. I''ve got two modules: artists and paintings.
In my home page, I''ve got a 2nd page that says "Browse paintings",
which displays ALL paintings of ALL artists. This is being rendered by
paintings#index.
In another page, I should show all paintings of a specific artist
ONLY. Meaning, paintings from ONE artist. I cant use paintings#index
for this anymore
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/.
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 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
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 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 =>
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|
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
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
2007 Jun 19
1
Display Options While Paginating
I have a table full of articles that I want to paginate. Easy enough
with:
[Controller]
@article_pages, @articles = paginate(:articles, :per_page =>
20, :order => ''post_date DESC, title ASC'')
BUT, there are different types of articles: regular news articles
(designated NA), and press releases (designated PR).
If I want to put each type in a different table on the same
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 =
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 Apr 07
2
Paginate single items
Hi,
In my blog i display a post. I want to display a link tot he previous
post if there is 1 and a link tot he next post if there is one.
So i have in my controller
def post
@post = Post.find(params[:id])
@post_pages, @posts = paginate :posts, :per_page => 1
render(:layout => false)
end
And the following code in post.rhtml
<% if @post_pages.current.next %>
<%=
2006 May 07
4
Paginate() from multiple tables
Hi
I''m wondering if there''s a way I can gather data from multiple tables
from the child table by using the paginate method?
I would have done it using select_by_sql but I need it to paginate.
My table structure is:
Records is a child of Date and Account
Date Account
| |
^ ^
Records
I want to be able to print a table using the Records controller that
will
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
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 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 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