これが私のコントローラーです:
def index
if params[:limit]
@bisacs = Bisac.order(:bisac_code).page(params[:page]).per(params[:limit])
else
@bisacs = Bisac.order(:bisac_code).page(params[:page])
end
end
これが私の見解です:
<%= paginate @bisacs %>
<%= page_entries_info @bisacs %>
エラーは次のとおりです。
undefined local variable or method `model' for #<Kaminari::Neo4j::Paginated:0x007ff2f211bf38>
行の場合:
<%= page_entries_info @bisacs %>
ここで何が欠けていますか?
しかし、 page_entries_info は、他のメソッドのコントローラーでこれを使用しているときに機能します。
q = "
MATCH (b:Bisac)
WITH b, size((b)<-[:INCLUDED_IN]-()) as wokas_count
RETURN b.bisac_code as bisac_code, b.bisac_value as bisac_value, wokas_count, b.uuid as uuid
ORDER BY b.bisac_code
;"
@result = Neo4j::Session.current.query(q).to_a
if params[:limit]
@result = Kaminari.paginate_array(@result).page(params[:page]).per(params[:limit])
else
@result = Kaminari.paginate_array(@result).page(params[:page])
end
ログファイルからのエラーに関する詳細情報は次のとおりです。
Started GET "/bisacs/d1d614a8-3c70-11e5-8eb8-22000b18b199" for 127.0.0.1 at 2015-08-12 12:49:58 -0400
Processing by BisacsController#show as HTML
Parameters: {"id"=>"d1d614a8-3c70-11e5-8eb8-22000b18b199"}
CYPHER 244ms MATCH (result_bisac:`Bisac`) WHERE (result_bisac.uuid = {result_bisac_uuid}) RETURN result_bisac ORDER BY result_bisac.uuid LIMIT {limit_1} | {:result_bisac_uuid=>"d1d614a8-3c70-11e5-8eb8-22000b18b199", :limit_1=>1}
Bisac#wokas 217ms MATCH bisac24319681 WHERE (ID(bisac24319681) = {ID_bisac24319681}) MATCH bisac24319681<-[rel1:`INCLUDED_IN`]-(result_wokas:`Woka`) RETURN count(result_wokas) AS result_wokas | {:ID_bisac24319681=>24319681}
Bisac#wokas 216ms MATCH bisac24319681 WHERE (ID(bisac24319681) = {ID_bisac24319681}) MATCH bisac24319681<-[rel1:`INCLUDED_IN`]-(result_wokas:`Woka`) RETURN count(result_wokas) AS result_wokas | {:ID_bisac24319681=>24319681}
Rendered bisacs/show.html.erb within layouts/application (239.6ms)
Completed 500 Internal Server Error in 707ms
ActionView::Template::Error (undefined local variable or method `model' for #<Kaminari::Neo4j::Paginated:0x007fad5de0ad28>):
18: <%= select_tag :limit, options_for_select([5, 10, 15, 20, 25, 30], selected: params[:limit] || 25) %>
19: <% end %>
20: <%= paginate @wokas %>
21: <%= page_entries_info @wokas %>
22:
23: <table>
24: <thead>
app/views/bisacs/show.html.erb:21:in `_app_views_bisacs_show_html_erb___1469171013071285334_70191290534340'
Rendered /Users/levi/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/templates/rescues/_source.erb (5.6ms)