Render an array in a view in ruby on rails

2019-09-02 01:10发布

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条回答
Evening l夕情丶
2楼-- · 2019-09-02 01:37

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

查看更多
登录 后发表回答