{"action":"created","issue":{"url":"https://api.github.com/repos/ga-wdi-boston/capstone-project/issues/275","repository_url":"https://api.github.com/repos/ga-wdi-boston/capstone-project","labels_url":"https://api.github.com/repos/ga-wdi-boston/capstone-project/issues/275/labels{/name}","comments_url":"https://api.github.com/repos/ga-wdi-boston/capstone-project/issues/275/comments","events_url":"https://api.github.com/repos/ga-wdi-boston/capstone-project/issues/275/events","html_url":"https://github.com/ga-wdi-boston/capstone-project/issues/275","id":180082625,"number":275,"title":"Persisting current user id and using in a route?","user":{"login":"alex-braun","id":19836608,"avatar_url":"https://avatars.githubusercontent.com/u/19836608?v=3","gravatar_id":"","url":"https://api.github.com/users/alex-braun","html_url":"https://github.com/alex-braun","followers_url":"https://api.github.com/users/alex-braun/followers","following_url":"https://api.github.com/users/alex-braun/following{/other_user}","gists_url":"https://api.github.com/users/alex-braun/gists{/gist_id}","starred_url":"https://api.github.com/users/alex-braun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alex-braun/subscriptions","organizations_url":"https://api.github.com/users/alex-braun/orgs","repos_url":"https://api.github.com/users/alex-braun/repos","events_url":"https://api.github.com/users/alex-braun/events{/privacy}","received_events_url":"https://api.github.com/users/alex-braun/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-09-29T15:30:12Z","updated_at":"2016-09-29T15:37:30Z","closed_at":null,"body":"For my project, I have a view that displays all recipes on my page.  Each one of these recipes has an edit and delete button.  Currently, I am getting the user_id of each recipe to see who created it, and I ALREADY have functionality on the backend that prevents anyone except for the user who created it from performing those CRUD actions (delete, put).  \r\n\r\nMy problem is that these buttons still display for ALL of the recipes despite some of them not being functional for the recipes that are not created by the current user.  \r\n\r\nMy backend simply does Recipe.all for index, and then requires currentUser for all other actions.\r\n\r\nIs it too much to ask for to have:\r\n\r\n```\r\n{{#if <function in route> }}\r\n```\r\n in my template \r\n\r\nAND then possibly reference the user model or variable from 'auth' (which holds user.id) in my route with a simple if user.id !== user_id? \r\n\r\nLauren told me about Ember.inject.service and I know this involves local storage, but I cannot wrap my head around this.\r\n\r\n\r\nLong story short, helping me persist a variable globally would be really swell."},"comment":{"url":"https://api.github.com/repos/ga-wdi-boston/capstone-project/issues/comments/250503068","html_url":"https://github.com/ga-wdi-boston/capstone-project/issues/275#issuecomment-250503068","issue_url":"https://api.github.com/repos/ga-wdi-boston/capstone-project/issues/275","id":250503068,"user":{"login":"laurenfazah","id":8062679,"avatar_url":"https://avatars.githubusercontent.com/u/8062679?v=3","gravatar_id":"","url":"https://api.github.com/users/laurenfazah","html_url":"https://github.com/laurenfazah","followers_url":"https://api.github.com/users/laurenfazah/followers","following_url":"https://api.github.com/users/laurenfazah/following{/other_user}","gists_url":"https://api.github.com/users/laurenfazah/gists{/gist_id}","starred_url":"https://api.github.com/users/laurenfazah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laurenfazah/subscriptions","organizations_url":"https://api.github.com/users/laurenfazah/orgs","repos_url":"https://api.github.com/users/laurenfazah/repos","events_url":"https://api.github.com/users/laurenfazah/events{/privacy}","received_events_url":"https://api.github.com/users/laurenfazah/received_events","type":"User","site_admin":false},"created_at":"2016-09-29T15:37:29Z","updated_at":"2016-09-29T15:37:29Z","body":"Yes, very doable.\r\n\r\nCredentials are stored in local storage, yes? Which service in your ember app has that access to that credentials object? You could inject that service into a route to access its credentials property.\r\n\r\nThink through that and give it a try. Obviously also ask any clarifying questions you have.\r\n\r\nOne place this is happening that you could reference is `my-application`, where a check for `isAuthenticated` is happening."}}
{"actor":{"display_login":"laurenfazah"}}