ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> ruby-rails
ruby-rails
Re: [Rails] Confused by the different syntax
by Scott Barron other posts by this author
Sep 9 2005 9:17AM messages near this date
[Rails] Confused by the different syntax | Re: [Rails] Confused by the different syntax
On Sep 9, 2005, at 10:58 AM, Marlon Moyer wrote:

>  I was reworking the 4 days on rails tutorial since I saw an easy way
>  to use related tables in the find method.  So I started to rework the
>  paginator code and got confused by the different syntax.
> 
>  This is my code that I was trying fix:
> 
>    def list_by_category
>      @item_pages = Paginator.new self, Item.count, 10, @params['page']
>   **   @items = Item.find(:all, :include=> :category, 
>  :order=>'category')
>      render_action 'list'
>    end
> 
>  This is what the wiki states about using the paginator:
> 
>    def list
>      @person_pages = Paginator.new self, Person.count, 10, 
>  @params['page']
>  **    @people = Person.find_all nil, 'last_name, first_name',
>  @person_pages.current.to_sql
>    end
> 
>  my question is about the starred line.  Is the second form the older
>  version?  Most of the examples I see have named arguments.  I think
>  the first two arguments are conditions and order_by, but what would be
>  the third argument in the second form.
> 
>  Thanks
> 
>  -- 
>  Marlon

The find_all form is crusty, old, and deprecated.  Use the former.

-- 
Scott Barron
Lunchbox Software
http://lunchboxsoftware.com
http://lunchroom.lunchboxsoftware.com

_______________________________________________
Rails mailing list
Rails@[...].org
http://lists.rubyonrails.org/mailman/listinfo/rails
Thread:
Marlon Moyer
Scott Barron
Joe Van Dyk

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved