{"action":"created","issue":{"url":"https://api.github.com/repos/neighborland/cache_rocket/issues/5","labels_url":"https://api.github.com/repos/neighborland/cache_rocket/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/neighborland/cache_rocket/issues/5/comments","events_url":"https://api.github.com/repos/neighborland/cache_rocket/issues/5/events","html_url":"https://github.com/neighborland/cache_rocket/issues/5","id":54696337,"number":5,"title":"Edit/delete buttons in lists","user":{"login":"amnesia7","id":1161448,"avatar_url":"https://avatars.githubusercontent.com/u/1161448?v=3","gravatar_id":"","url":"https://api.github.com/users/amnesia7","html_url":"https://github.com/amnesia7","followers_url":"https://api.github.com/users/amnesia7/followers","following_url":"https://api.github.com/users/amnesia7/following{/other_user}","gists_url":"https://api.github.com/users/amnesia7/gists{/gist_id}","starred_url":"https://api.github.com/users/amnesia7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amnesia7/subscriptions","organizations_url":"https://api.github.com/users/amnesia7/orgs","repos_url":"https://api.github.com/users/amnesia7/repos","events_url":"https://api.github.com/users/amnesia7/events{/privacy}","received_events_url":"https://api.github.com/users/amnesia7/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-01-18T13:23:29Z","updated_at":"2015-01-19T16:37:48Z","closed_at":null,"body":"How would you go on for adding edit/delete buttons for each item in a collection so that they can be shown alongside the post name (for instance)?\r\n\r\nDo you create each link using the Proc syntax and pass them in as keys which seems a little messy or is there a way to pass in post name as a key and pass in an object or an id or something for the edit / delete buttons?\r\n\r\n__posts/index.html.erb__\r\n```\r\n<%= render_cached 'post',\r\n  collection: @posts,\r\n  replace: {\r\n    name: -> (post) { post.name },\r\n    ...\r\n%>\r\n```\r\n\r\nThe kind of output I'm trying to get is (simplified):\r\n```\r\n<tr>\r\n  <td>Post name here</td>\r\n  <td><a href=\"/posts/1/edit\">Edit</a></td>\r\n  <td><a href=\"/posts/1\" data-method=\"delete\">Delete</a></td>\r\n</tr>\r\n```\r\n\r\nThanks"},"comment":{"url":"https://api.github.com/repos/neighborland/cache_rocket/issues/comments/70522897","html_url":"https://github.com/neighborland/cache_rocket/issues/5#issuecomment-70522897","issue_url":"https://api.github.com/repos/neighborland/cache_rocket/issues/5","id":70522897,"user":{"login":"teeparham","id":54017,"avatar_url":"https://avatars.githubusercontent.com/u/54017?v=3","gravatar_id":"","url":"https://api.github.com/users/teeparham","html_url":"https://github.com/teeparham","followers_url":"https://api.github.com/users/teeparham/followers","following_url":"https://api.github.com/users/teeparham/following{/other_user}","gists_url":"https://api.github.com/users/teeparham/gists{/gist_id}","starred_url":"https://api.github.com/users/teeparham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/teeparham/subscriptions","organizations_url":"https://api.github.com/users/teeparham/orgs","repos_url":"https://api.github.com/users/teeparham/repos","events_url":"https://api.github.com/users/teeparham/events{/privacy}","received_events_url":"https://api.github.com/users/teeparham/received_events","type":"User","site_admin":false},"created_at":"2015-01-19T16:37:48Z","updated_at":"2015-01-19T16:37:48Z","body":"You could make helper methods for the buttons and do it like this:\r\n\r\nposts_helper.rb\r\n```ruby\r\ndef edit_button(post)\r\n  link_to \"edit post\", edit_post_path(post)\r\nend\r\n\r\ndef delete_button(post)\r\n  # delete button code\r\nend\r\n```\r\n\r\n_index.html.erb\r\n```erb\r\n<%= render_cached 'post',\r\n          collection: @posts,\r\n          replace: { \r\n            edit_button: -> (post) { edit_button(post) },\r\n            delete_button: -> (post) { delete_button(post) }\r\n        }\r\n%>\r\n```\r\n_post.html.erb\r\n```erb\r\n<tr>\r\n  <td>Post name here</td>\r\n  <td><%= cache_replace_key :edit_button %></td>\r\n  <td><%= cache_replace_key :delete_button %></td>\r\n</tr>\r\n```\r\n"}}