Given the code below:
var photos = [
<% current_app_user.photos.each do |photo| %>
{ url: "<%= photo.thumbnail_uri(400, 189) %>", title: "<%= truncate(photo.name, 65) %>", path :"<%= photo_path(photo) %>" },
<% end %>
];
How would I modify it to only pull 10 photos at a time?
Initially, I’d like to generate 10, then with the click of a button append 10 more and so on.
You should do this in a controller, not in your view, but inside a controller you should do it like this:
And in your view:
No code in your view other than what’s strictly necessary 🙂