Z
zenshade
As I'm very much still a ruby newbie, I'm hoping someone can help me to
correctly parse the following statement generated by Rails scaffolding:
@category_pages, @categories = paginate :category, er_page => 10
This statement occurs in the following context:
class CategoriesController < ApplicationController
..
..
..
def list
@category_pages, @categories = paginate :category, er_page => 10
end
..
..
..
end
Now, I know that paginate is a method of the ActionController class,
but is it being called with two arguments or one? And if it is being
called with two arguments category, er_page => 10), how is
multi-assignment working here?
To me, this looks like @category_pages will get the return value of the
paginate method, and @categories will be assigned the value nil.
Any advice on how to correctly understand this assignment statement
would be greatly appreciated.
correctly parse the following statement generated by Rails scaffolding:
@category_pages, @categories = paginate :category, er_page => 10
This statement occurs in the following context:
class CategoriesController < ApplicationController
..
..
..
def list
@category_pages, @categories = paginate :category, er_page => 10
end
..
..
..
end
Now, I know that paginate is a method of the ActionController class,
but is it being called with two arguments or one? And if it is being
called with two arguments category, er_page => 10), how is
multi-assignment working here?
To me, this looks like @category_pages will get the return value of the
paginate method, and @categories will be assigned the value nil.
Any advice on how to correctly understand this assignment statement
would be greatly appreciated.