Paginate @member.items?

Is there a quick and easy way to paginate something
like @member.items (Member with has_many :items)?
Right now I do in the controller:

@item_pages, @member_items = paginate :item,
:conditions=>[“member_id=?”, @member.id],
:per_page=>25,
:order=>‘datetime desc’

It’d be more DRY if this was possible:

@item_pages, @member_items = paginate @member.items,
:per_page=>25,
:order=>‘datetime desc’

And even more so if it could all be done in the
template:

<% for item in @member.items(:limit=>25,
:offset=>params[:page]*25) %>

<% end %>

<%= pagination_links @member.items, offset, limit, …
%>

Any ideas?

Thanks,
csn


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around

Hi CSN,

Any luck with a solution for this prob? I am facing the same problem
now?

Regards,
Sandeep G

CSN wrote:

Is there a quick and easy way to paginate something
like @member.items (Member with has_many :items)?
Right now I do in the controller:

@item_pages, @member_items = paginate :item,
:conditions=>[“member_id=?”, @member.id],
:per_page=>25,
:order=>‘datetime desc’

It’d be more DRY if this was possible:

@item_pages, @member_items = paginate @member.items,
:per_page=>25,
:order=>‘datetime desc’

And even more so if it could all be done in the
template:

<% for item in @member.items(:limit=>25,
:offset=>params[:page]*25) %>

<% end %>

<%= pagination_links @member.items, offset, limit, …
%>

Any ideas?

Thanks,
csn


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com