问题
At the controller end, I have an array
@bookmarks = Bookmark.where('user_id = ? && note is NULL',current_user.id).order('created_at DESC').page(params[:page_2]).per(4)
Then at the View I have this render tag through which I want to render @bookmarks
<%= render @bookmarks %>
Then there is page for _bookmark which will display @bookmarks
bookmark.title
bookmark.created_at
But this process is giving me error of no partial. (I try to implement kaminari via Ajax)
回答1:
using the render method like that will 'cause it to look for a partial in bookmarks/_bookmark.
you can also specify the partial and collection with render partial: 'folder/mypartial', collection: @bookmarks
来源:https://stackoverflow.com/questions/9014923/render-an-array-in-a-view-in-ruby-on-rails