我第一次尝试使用 kaminari 进行分页,但出现错误:
views/store/index.html.erb where line #23 raised:
undefined method `current_page' for #<Array:0x3ebe0c0>
Extracted source (around line #23):
20: </div>
21: </div>
22: <%end%>
23: <%= paginate @buildings %>
控制器>建筑物_控制器
def index
@buildings = Building.all.page(params[:page]).per(1)
respond_to do |format|
format.html # index.html.erb
format.json { render json: @buildings }
end
end
商店>索引
<%= paginate @buildings %>
我做错了什么?