{"action":"created","issue":{"url":"https://api.github.com/repos/ga-wdi-boston/capstone-project/issues/265","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/265/labels{/name}","comments_url":"https://api.github.com/repos/ga-wdi-boston/capstone-project/issues/265/comments","events_url":"https://api.github.com/repos/ga-wdi-boston/capstone-project/issues/265/events","html_url":"https://github.com/ga-wdi-boston/capstone-project/issues/265","id":179790056,"number":265,"title":"Displaying current_user posts","user":{"login":"jlmitch1989","id":19956362,"avatar_url":"https://avatars.githubusercontent.com/u/19956362?v=3","gravatar_id":"","url":"https://api.github.com/users/jlmitch1989","html_url":"https://github.com/jlmitch1989","followers_url":"https://api.github.com/users/jlmitch1989/followers","following_url":"https://api.github.com/users/jlmitch1989/following{/other_user}","gists_url":"https://api.github.com/users/jlmitch1989/gists{/gist_id}","starred_url":"https://api.github.com/users/jlmitch1989/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlmitch1989/subscriptions","organizations_url":"https://api.github.com/users/jlmitch1989/orgs","repos_url":"https://api.github.com/users/jlmitch1989/repos","events_url":"https://api.github.com/users/jlmitch1989/events{/privacy}","received_events_url":"https://api.github.com/users/jlmitch1989/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":18,"created_at":"2016-09-28T14:31:28Z","updated_at":"2016-09-28T16:39:44Z","closed_at":null,"body":"I'm getting really confused on how to display current_user posts.  In my app I have forum button which gets all posts. I also have a My Threads button which is what I want use to get current_user posts. \r\n\r\nOn my backend I know I need to create a specific GET route like so:\r\n\r\n```rb\r\n  # gets current user posts\r\n  get '/my-posts/' => 'posts#index'\r\n```\r\n\r\nThen in my posts controller I need to make an if else statement which sets up current_user params:\r\n\r\n```rb\r\n  def index\r\n    if params[:current_user] == 'true'\r\n      # p params\r\n      p current_user\r\n      # binding.pry\r\n      @posts = current_user.posts\r\n    else\r\n      @posts = Post.all\r\n    end\r\n\r\n    render json: @posts\r\n  end\r\n```\r\n\r\nI used code from my second project, mostly because I wasn't sure how to make this work. \r\n\r\nMy confusion is in the frontend.  I have a posts route which uses a .findAll('post').\r\nI'm not sure how to access current users from this point.\r\n\r\nI've tried reading about different methods besides .findAll().  I haven't been able to find anything useful.  Any help would be great!"},"comment":{"url":"https://api.github.com/repos/ga-wdi-boston/capstone-project/issues/comments/250223794","html_url":"https://github.com/ga-wdi-boston/capstone-project/issues/265#issuecomment-250223794","issue_url":"https://api.github.com/repos/ga-wdi-boston/capstone-project/issues/265","id":250223794,"user":{"login":"jlmitch1989","id":19956362,"avatar_url":"https://avatars.githubusercontent.com/u/19956362?v=3","gravatar_id":"","url":"https://api.github.com/users/jlmitch1989","html_url":"https://github.com/jlmitch1989","followers_url":"https://api.github.com/users/jlmitch1989/followers","following_url":"https://api.github.com/users/jlmitch1989/following{/other_user}","gists_url":"https://api.github.com/users/jlmitch1989/gists{/gist_id}","starred_url":"https://api.github.com/users/jlmitch1989/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlmitch1989/subscriptions","organizations_url":"https://api.github.com/users/jlmitch1989/orgs","repos_url":"https://api.github.com/users/jlmitch1989/repos","events_url":"https://api.github.com/users/jlmitch1989/events{/privacy}","received_events_url":"https://api.github.com/users/jlmitch1989/received_events","type":"User","site_admin":false},"created_at":"2016-09-28T16:39:44Z","updated_at":"2016-09-28T16:39:44Z","body":"I thought that's what I was doing when using Lauren's instructions?"}}
{"actor":{"display_login":"jlmitch1989"}}