Displaying 20 results from an estimated 5000 matches similar to: "Paginate include => :last and order by value"
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 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 Aug 17
0
super-newb needs help with has_many and other things...
I am brand new to oop and am having a difficult time getting my head
around some ruby stuff. In specific, I am trying to create a library
style app that lists topics, articles and comments. I have a table
called topics, a table called articles and a table called comments. My
models, controller and view are all listed below. What I want to happen
is to have the list view list each topic along
2006 Mar 16
3
How to paginate in descending order?
How can I paginate a set of fields in descending order based on their
created_on date?
For example, in a blog app, you want the very first entry on the first
page to be the most recent.
I see that paginate has an :order parameter, but I don''t see any way of
changing the direction of the order.
Thanks,
Jeff Coleman
--
Posted via http://www.ruby-forum.com/.
2008 May 19
0
changed to will_paginate
Hi
Till now we used the rails pagination.But now onwards shifting to
will_paginate
The code I use currently is as below .This is with the help of
find_where pluggin..A fantastic pluggin which we still want to use...I
would like to know how can i modify the following code to work with
will_paginate
step 1: set the variables you''ll need
page = (params[:page] ||= 1).to_i
2006 Mar 08
2
Displaying related tables in forms.. probably an easy question!
Hey All,
I have two tables.. One belongs to another. Why can''t I reference
table1.table2.attribute?
Specifically, using scaffolding:
property.rb -
has_one :PropertyType
property_type.rb -
has_many :Properties
property_controller -
def list
@property_pages, @properties = paginate :properties, :per_page => 10
end
list.html:
1. <% for property in @properties %>
2.
2006 Feb 02
1
circular table refs in activerecord
I cannot find this anywhere, and it is holding up a project. I have a
*very* simple rails app with three tables, one of which is the users
table:
users:
Column | Type | Modifiers
---------------+-----------------------------+-----------------
id | integer | not null default nextval(''public.users_id_seq''::text)
login
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 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 Mar 09
0
Re: Displaying related tables in forms.. probably an easy qu
Steve -
That was the issue.. It seems obvious now, but I needed to reference
Property.PropertType.name instead of property.propertytype.name
Thanks!!
Brian
-----Original Message-----
From: rails-bounces@lists.rubyonrails.org
[mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of Steve
Koppelman
Sent: Wednesday, March 08, 2006 5:00 PM
To: rails@lists.rubyonrails.org
Subject: [Rails] Re:
2006 Jun 13
2
four days on rails - nil object when you didnt expect it
Hi all,
Im trying to get my head around rails and to help along Im working
through "four days on rails" as this seems to give a good real world
example with multiple tables and relationships (the main thing I cant
work out!)
Ive got stuck. Some help would be really good here.
The controller has this code:
def list
@category_pages, @categories = paginate(:category, :per_page =>
2005 Dec 29
4
Paginate do a Count(*) request before, how access that count value.
Hello,
AV::paginate query first by a count, how access this value in the
controller or view ?
Why ?
Because I''ll like to display the total number or records found w/o
doing another expenssive Count.
Thanks,
2006 Jun 11
0
mySQL paginate syntax question for complex SQL. (over 117 views in rubyonrailsforum and no answer, others confused..)
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 incite would be great, thanks in advance!
(over 117 views and no answer in rubyonrailsforum???)
def display_location
if params[:search] &&
2006 Jan 10
0
Paginate with two tables ?
First I read previous thread with similar problem but I don''t find answer
(problem is little diffrent)
Hello, I have problem with display information from two tables using
paginate..
Here is code.
##### SQL
create table subscribers (
id integer not null auto_increment,
name varchar(32) not null,
surname varchar(64) not null,
create_timestamp DATETIME not null,
modify_timestamp DATETIME
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 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 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 Aug 02
2
Ajax_Scaffold display from link table
Hi,
Ive followed the pets/people ajax_scaffold example without any problem.
I have a table documents and each document has a category. In the
documents table i have a field called category_id. So in the documents
grif i want to display the corresponding catgory name and when it comes
to adding a new category or editing the have a drop down list to select
from.
category.rb
require
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