{"action":"created","issue":{"url":"https://api.github.com/repos/ga-dc/project2/issues/335","labels_url":"https://api.github.com/repos/ga-dc/project2/issues/335/labels{/name}","comments_url":"https://api.github.com/repos/ga-dc/project2/issues/335/comments","events_url":"https://api.github.com/repos/ga-dc/project2/issues/335/events","html_url":"https://github.com/ga-dc/project2/issues/335","id":117361261,"number":335,"title":"issue with accessing user_id using current_user","user":{"login":"schersh","id":13408456,"avatar_url":"https://avatars.githubusercontent.com/u/13408456?v=3","gravatar_id":"","url":"https://api.github.com/users/schersh","html_url":"https://github.com/schersh","followers_url":"https://api.github.com/users/schersh/followers","following_url":"https://api.github.com/users/schersh/following{/other_user}","gists_url":"https://api.github.com/users/schersh/gists{/gist_id}","starred_url":"https://api.github.com/users/schersh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schersh/subscriptions","organizations_url":"https://api.github.com/users/schersh/orgs","repos_url":"https://api.github.com/users/schersh/repos","events_url":"https://api.github.com/users/schersh/events{/privacy}","received_events_url":"https://api.github.com/users/schersh/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2015-11-17T14:08:38Z","updated_at":"2015-11-17T14:37:40Z","closed_at":null,"body":"I am having an issue with trying to use the devise helper method \"current_user\". I expected current_user to allow me to access and reference the id of the signed-in usr, but whenever I try to use current_user, I receive a Rails error message like: \"unknown attribute 'user' for Apartment.\" I've been reading the Devise documentation on github [https://github.com/plataformatec/devise#controller-filters-and-helpers], but I can't seem to figure out what I'm doing wrong. \r\n     \r\nHere is the code from my Apartment controller:    \r\n```rb\r\ndef new\r\n    @apartment = Apartment.new\r\nend\r\n\r\ndef create\r\n    @apartment = current_user.apartment.new(apartment_params)\r\n    if @apartment.save\r\n      flash[:notice] = \"#{@apartment.name} was successfully created!\"\r\n      redirect_to apartments_path(current_user, @apartment).\r\n    else\r\n      render :new\r\n    end\r\nend\r\n```\r\nThe link to my github repo is: https://github.com/schersh/Project-2 (please refer to the \"temp\" branch). Thank you!\r\n"},"comment":{"url":"https://api.github.com/repos/ga-dc/project2/issues/comments/157387842","html_url":"https://github.com/ga-dc/project2/issues/335#issuecomment-157387842","issue_url":"https://api.github.com/repos/ga-dc/project2/issues/335","id":157387842,"user":{"login":"andrewsunglaekim","id":8976305,"avatar_url":"https://avatars.githubusercontent.com/u/8976305?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewsunglaekim","html_url":"https://github.com/andrewsunglaekim","followers_url":"https://api.github.com/users/andrewsunglaekim/followers","following_url":"https://api.github.com/users/andrewsunglaekim/following{/other_user}","gists_url":"https://api.github.com/users/andrewsunglaekim/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewsunglaekim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewsunglaekim/subscriptions","organizations_url":"https://api.github.com/users/andrewsunglaekim/orgs","repos_url":"https://api.github.com/users/andrewsunglaekim/repos","events_url":"https://api.github.com/users/andrewsunglaekim/events{/privacy}","received_events_url":"https://api.github.com/users/andrewsunglaekim/received_events","type":"User","site_admin":false},"created_at":"2015-11-17T14:37:40Z","updated_at":"2015-11-17T14:37:40Z","body":"I'm not familiar with the `add_foreign_key` syntax, but check your `db/schema.rb` file to look at what it generated for you."}}