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 Joe Van Dyk other posts by this author
Sep 9 2005 9:14AM messages near this date
Re: [Rails] Confused by the different syntax | Fw: [Rails] No one interested in DB2 drivers for Ruby - what does it mean?
On 9/9/05, Marlon Moyer <marlon.moyer@[...].com>  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.

Yes, second form is a depreciated version of the find method.  I think
the third argument is just a SQL statement that would do some ordering
(like 'order by DESC' or whatever).
_______________________________________________
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