Displaying 20 results from an estimated 7000 matches similar to: "Doubts after generating with scaffold"
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 
2006 Aug 07
4
Problem with Pagination
Hi Guys,
I am trying to paginate the results from a search.  When I use actual 
constants in the search conditions, it works fine:
def query
    @k2_result_pages, @k2_results = paginate (:k2_results,
                                        :conditions => [''e_date >= ? AND 
e_date <= ?'', ''2006-07-12'', ''2006-08-12''],
                  
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: 
2006 May 14
4
searching on foreing keys
Hey all,
I''m using a simple search function. It''s working
great except for foreign keys.
I have one table pets (id,name,owner_id)
and another 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
2006 Jan 03
0
has_and_belongs_to_many include problem
hey,
i have users who are in groups, and i have a search form, where i can search on
group, user lastname, and user firstname.
All this is also with pagination.
these are my models
class User < ActiveRecord::Base
has_and_belongs_to_many :groups
end
class Group < ActiveRecord::Base
    has_and_belongs_to_many :users
end
in my controller i do this
THIS works (but in need pagination)
@users2
2006 Feb 08
7
DRY methodology
because I am a grasshopper...
Now that I can sort my ''list''...is there a logical way of not 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 =>
2005 Aug 04
1
Pagination and :include (eager associations)
I have tried to use eager association with pagination, but  
the :include option is not supported:
Here''s the one-line pagination call without :include
     @link_pages, @links = paginate :link, :per_page => 10, :order_by  
=> sort_clause
and here the work around, using the "classic" method
#    @link_pages = Paginator.new self, Link.count, 10,
2006 Feb 07
11
breaking down a list view
I''m trying to figure 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
2006 Feb 03
1
modifying scaffold method
I''ve made the following changes to scaffolding.rb.  Is it possible to
put those changes into some type of a plugin or helper or something,
instead of directly modifying the Rails source?
(and, btw, I think pagination should be removed from scaffolding.  And
deletes should only happen on post requests.  That''s essentially what
I''ve changed).
Thanks,
Joe
Index:
2006 Jul 03
0
Pagination with acts_as_ferret
Hey there,
Previous to finding ferret I had a test query setup to do pagination 
like:
    @listing_pages, @listings =
    paginate(:listing, :per_page => 10,
             :conditions => [" name LIKE ? ", "%" + search_criteria + 
"%"],
             :order_by => "name ASC")
Can I do similar pagination with @results array returned from a ferret 
2006 Apr 19
2
Filtering items within scaffold
I''m messing with the agiles store example.  I added a field in my 
product table (user_id) that is also a foreign key relationship via 
fk_products_user
In my scaffold I''d like to list the products as usual, but only those 
products from the logged in user.  I assume that would be done in the 
controller..
How would I extend the basic controller:
  def list
    @product_pages,
2006 Feb 18
1
sql logic is killing me
I know my thinking is sloppy.
I want to know how many clients currently in my facility are male...
My facilities_controller.rb
  def list_fac
    @placement_pages, @placements = paginate(
      :placements, 
      :conditions => ["placements.facility_id = ?",
        params[:facility_id] ],
      :include => [:facility, :client],
      :order_by => ''facilities.name,
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 27
0
Typo 1055 created_at Vs. published_at
[Couldn''t post this to the Typo forum, hope it''s Ok here :-)]
Before I go off and create a Typo ticket, I''d like to know if anyone 
else is experiencing this and what there thoughts might be on the 
subject?
In Typo 1055, if you use the admin interface and change the published 
date for an article, you will get "post not found", when you click on 
the article
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
2006 Jan 04
8
Trying to display data from two tables
Alrighty folks, I''m really trying here, and want to succeed with Ruby on 
Rails.
I''m trying to display data that is linked from two tables using the 
Active Record naming conventions, as described in Agile Web book.
The stripped-down basics;
Database
drop table if exists people;
CREATE TABLE `people` (
  `id` int(6) NOT NULL auto_increment,
  `lastname` varchar(30) NOT NULL,
2006 Aug 15
2
Working with user data
I am a Rails newbie and I am trying to build a test site in which users 
will have their own sets of data.
I understand how to manipulate shared data very well. Most of the Rails 
examples out there seem to deal with such shared data. I am struggling 
with the "best practice" method for a user to work with their own data 
however (and not be able to view/edit other users''
2006 Apr 10
1
How to specify Ascending or Descending Option?
Hi,
I am accessing records in Stores table as follows in @store object.
=============================================
@store_pages, @stores = paginate :stores, :order_by => ''store_rating'', 
:per_page => 10
=============================================
Now I want that records returned by above objects should be in 
descending order. How to do this in above statement?
2006 Jan 24
1
Pagination
Hello,
maybe that I''m a stupid, but I don''t know how I can working with 
pagination. In all examples is written (for example) next:
def user_list
  @user_pages, @users = paginate(:users, :order_by => ''name'')
end
So, it''s OK (as a scaffold) for all set of users. But I need a little 
other functionality. For example I need paginate only a little bit
2006 Jan 19
8
Pagination_links without "?page=" but with params[:id]
Hello,
With default pagination I have this :
<a href="/users/infos/3?page=1">1</a>
<a href="/users/infos/3?page=3">3</a>
but i need this :
<a href="/users/infos/1">1</a>
<a href="/users/infos/3">3</a>
I need to remove the "?page=" parameters and rewrite a little the link ( with a link_to ? )