Displaying 20 results from an estimated 3000 matches similar to: "Refactor sorting of images"
2006 Aug 17
8
Creating queries..
Hi, I am trying to implement a few queries now. What are good ways to do
this?
Right now, I have a list page that does sorting and can carry out a
generic pagination request.
@user_result_pages, @user_results = paginate(:user_results,
:per_page => 20,
:conditions => @condition,
:order_by => @sort_order)
I create @sort_order earlier in the list function. The problem I am
having is
2005 Oct 05
2
customer defined sort order
I have a category list which the customer wants administratively to define
the sort order, instead of alphabetical or whatever. The obvious approach
seems to be to put a sort_order int on the record and use this as the
presentation sort order. Then to shift the item up in the sort order to swap
the current and the prevous item in the sort_order.
Does this seem like a sensible approach, or is
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
2010 Dec 02
0
Thinking Sphinx sorting problem
Hello all,
I''m trying to get some records in my application to sort based on a SQL
calculated value and am getting no records returned. I have checked and
double checked and the query that TS is indexing is working out, but the
problem is with the controller.
Here is what I''m indexing:
----------------------------------------------------------
indexes
2009 Apr 05
5
Use a value from a different model
Hello,
I cannot find the issue and it drives me crazy :(
let''s simplify. I have 2 models: saving and purchase_type
a *saving* corresponds to a *purchase_type* e.g. new sourcing or
renegotiation
a saving has exactly one purchase_type and a purchase_type has many
savings.
when I try to display the list of savings and their purchase type
(name, not Id), i get the dreaded "You have a
2006 Aug 15
1
sorting attribute in list from foreign table
Hello, I currently have two tables.
table_a (
id
table_b_id
other_attrs
)
table b (
id
name
)
So table A holds an id from table B. During the listing of tuples in
table A, it lists table A''s attributes. In place of the table B id, I
check the id, and instead display the name corresponding to that id. Now
I want to be able to sort the listing of tuples in table A by the
2006 Jan 31
3
Lost in routing
I''m trying to create a modules based system where my controllers are
all under modules. So the structure looks something like:
app/
controllers/
message/
news_controller.rb
email_controller.rb
library
books_controller.rb
pictures_controller.rb
home_page_controller.rb
Each of those controller has
2005 Dec 31
3
Semi-Dynamic table sorting (without AJAX)
In a previous thread some people were interested in ways to sort a
table. I mentioned a simple method for doing so by using links in the
titles. Having actually tried to implement this strategy, I have come
across several refinements that I would like to share.
First...
your table view should look like this...
...
<table>
<tr>
<th><%= link_to
2006 Aug 14
5
Tutorial for Queries
Hi! I''m looking for a good tutorial that explains the main points of
performing queries with Rails. I do have AWDWR and have read the
section on ''find'' but I''m looking for something that goes into more
detail on how to perform queries across tables.
Abstracted from my current application, this is an example:
* person has_many sites
* site has_one room
*
2007 Jun 14
1
rspec will_paginate
Hi Rspec-Users,
I''m not sure if 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
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
2012 Dec 05
0
Announce: Puppet Dashboard 1.2.15 available
Puppet Dashboard 1.2.15 is a bugfix release of the 1.2 series of
Puppet Dashboard.
This release is available for download at:
https://downloads.puppetlabs.com/dashboard/puppet-dashboard-1.2.15.tar.gz
Debian packages are available at
https://apt.puppetlabs.com
RPM packages are available at
https://yum.puppetlabs.com
Please report feedback via the Puppet Labs Redmine site, using an
affected
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 %>
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:FalseClass
RAILS_ROOT:
2006 Nov 08
0
Paginating a fetched resultset problems with next/previous
Im using this paginate function to paginate complex sql queries
http://www.bigbold.com/snippets/posts/show/389, all seems to work fine
but theres one thing, when i hit the next link it show nothing, i mean
it only shows the first page, here is the code im using:
#application.rb-----------------
def paginate_collection(collection, options = {})
default_options = {:per_page => 10, :page
2006 Apr 16
7
table sorting
Ahoy,
I checked the API and did some forum searches but didn''t find anything
good on table sorting.
Is there a "railish" way to do this? My current method really is lacking
(i''m on like rails day 2)
<th><%= link_to ''Name'', :action => ''list'', :order => ''name'' %></th>
2006 Feb 01
1
Rails pagination problem
I am having this problem with pagination query in my controller class.
I am using SQL server and following code to create pagination fails,
complains about column name ''program_name'' (which is valid
column/attribute of program)
The error message is:
DBI::DatabaseError: S0022 (207) [Microsoft][ODBC SQL Server
Driver][SQL Server]Invalid column name
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 Jan 26
1
Simple question about :list method in scaffolds
The automatically generated scaffolds made code like this:
def list
@address_pages, @addresses = paginate :addresses, :per_page => 10
end
which was fine, but I only want to return the logged-in user''s
addresses. So I changed it to:
def list
@address_pages, @addresses = paginate :addresses, :per_page => 10,
:conditions => [''user_id = ?'',
2009 Aug 13
2
ajax with will_paginate problem
i can use <%= link_to_remote("MEMBER LIST",:update => "mcont", :url =>
{:controller => :users, :action => :list }) %> this for user listing and
then it display record i want to do paging on this list file but it is
display one page when i click on second page this will no go to second
my controller
def list
#@images = Image.paginate :page =>