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
|