Hi Nick,
Ok, so I guess from what you ask, I am not completely off track. That is good.
What I have is an "items" widget that renders multiple "item" widgets using the code that I previously posted. To test it, I have a controller action that has this one-line view
<%= render_widget :items %>
When I change the item query from "item.all.each" to "item.all.paginate.each", the controller action results in an error:
Started GET "/" for 127.0.0.1 at 2014-05-02 10:34:13 +0100
Processing by ItemsController#index as HTML
Rendered items/index.html.erb within layouts/application (1.9ms)
Completed 500 Internal Server Error in 4ms
ActionView::Template::Error (wrong number of arguments (0 for 1)):
1: <%= render_widget :items %>
app/widgets/items_widget.rb:4:in `display'
app/views/items/index.html.erb:1:in `_app_views_items_index_html_erb___2290554104468074472_69935533011680'
Here is the offending app/widgets/items_widget.rb in its entirety. If I remove the word "paginate" from line 4, everything works (albeit without pagination).
1 class ItemsWidget < ApplicationWidget
2
3 def display
4 Item.all.paginate.each do |i|
5 self << widget('items/item',
i.id, item: i)
6 end
7 render
8 end
9
10 end