{"action":"created","issue":{"url":"https://api.github.com/repos/premier-spa/research_app/issues/56","repository_url":"https://api.github.com/repos/premier-spa/research_app","labels_url":"https://api.github.com/repos/premier-spa/research_app/issues/56/labels{/name}","comments_url":"https://api.github.com/repos/premier-spa/research_app/issues/56/comments","events_url":"https://api.github.com/repos/premier-spa/research_app/issues/56/events","html_url":"https://github.com/premier-spa/research_app/issues/56","id":372976142,"node_id":"MDU6SXNzdWUzNzI5NzYxNDI=","number":56,"title":"Labs関連のルーティングとアクションの修正","user":{"login":"Kuratech5","id":27124851,"node_id":"MDQ6VXNlcjI3MTI0ODUx","avatar_url":"https://avatars2.githubusercontent.com/u/27124851?v=4","gravatar_id":"","url":"https://api.github.com/users/Kuratech5","html_url":"https://github.com/Kuratech5","followers_url":"https://api.github.com/users/Kuratech5/followers","following_url":"https://api.github.com/users/Kuratech5/following{/other_user}","gists_url":"https://api.github.com/users/Kuratech5/gists{/gist_id}","starred_url":"https://api.github.com/users/Kuratech5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kuratech5/subscriptions","organizations_url":"https://api.github.com/users/Kuratech5/orgs","repos_url":"https://api.github.com/users/Kuratech5/repos","events_url":"https://api.github.com/users/Kuratech5/events{/privacy}","received_events_url":"https://api.github.com/users/Kuratech5/received_events","type":"User","site_admin":false},"labels":[{"id":1021656047,"node_id":"MDU6TGFiZWwxMDIxNjU2MDQ3","url":"https://api.github.com/repos/premier-spa/research_app/labels/bug","name":"bug","color":"d73a4a","default":true},{"id":1091730698,"node_id":"MDU6TGFiZWwxMDkxNzMwNjk4","url":"https://api.github.com/repos/premier-spa/research_app/labels/required","name":"required","color":"ffff00","default":false}],"state":"open","locked":false,"assignee":{"login":"Kuratech5","id":27124851,"node_id":"MDQ6VXNlcjI3MTI0ODUx","avatar_url":"https://avatars2.githubusercontent.com/u/27124851?v=4","gravatar_id":"","url":"https://api.github.com/users/Kuratech5","html_url":"https://github.com/Kuratech5","followers_url":"https://api.github.com/users/Kuratech5/followers","following_url":"https://api.github.com/users/Kuratech5/following{/other_user}","gists_url":"https://api.github.com/users/Kuratech5/gists{/gist_id}","starred_url":"https://api.github.com/users/Kuratech5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kuratech5/subscriptions","organizations_url":"https://api.github.com/users/Kuratech5/orgs","repos_url":"https://api.github.com/users/Kuratech5/repos","events_url":"https://api.github.com/users/Kuratech5/events{/privacy}","received_events_url":"https://api.github.com/users/Kuratech5/received_events","type":"User","site_admin":false},"assignees":[{"login":"Kuratech5","id":27124851,"node_id":"MDQ6VXNlcjI3MTI0ODUx","avatar_url":"https://avatars2.githubusercontent.com/u/27124851?v=4","gravatar_id":"","url":"https://api.github.com/users/Kuratech5","html_url":"https://github.com/Kuratech5","followers_url":"https://api.github.com/users/Kuratech5/followers","following_url":"https://api.github.com/users/Kuratech5/following{/other_user}","gists_url":"https://api.github.com/users/Kuratech5/gists{/gist_id}","starred_url":"https://api.github.com/users/Kuratech5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kuratech5/subscriptions","organizations_url":"https://api.github.com/users/Kuratech5/orgs","repos_url":"https://api.github.com/users/Kuratech5/repos","events_url":"https://api.github.com/users/Kuratech5/events{/privacy}","received_events_url":"https://api.github.com/users/Kuratech5/received_events","type":"User","site_admin":false}],"milestone":null,"comments":3,"created_at":"2018-10-23T12:33:52Z","updated_at":"2018-10-24T04:02:43Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"現状では、ログインユーザに基づいたルーティングになっている。\r\nそのため、メニューバーを利用したサイト内の画面遷移を行おうとすると、必ず自分の研究室HPにとんでしまう。\r\n\r\nこれを、任意のユーザが任意の研究室サイトページを閲覧できるように修正する。\r\n\r\n例：\r\n```\r\nlabs/:lab_id/works/:id\r\nlabs/:lab_id/people/:id\r\n```\r\n\r\n\r\nidパラメータは、メニューバー内にMyLaboratoryへ飛ぶボタンを作成したいのでできればほしい。\r\nユーザのログイン状態が確認できるのであれば、パスにid paramを含めなくてもよいが、そこあたりの詳細の知識がないので分かる方いたら教えてください。\r\n\r\n\r\n\r\nおそらく\r\nroutes.rb内の\r\nmember doを削除して、\r\n```\r\nget 'about'\r\nget 'people'\r\nget 'contact'\r\n```\r\nもしくは\r\n```\r\nget '/about/:id', to: 'labs#about', as: 'about'\r\nget 'people/:id', to: 'labs#people', as: 'people'\r\nget 'contact/:id', to: 'labs#contact', as: 'contact'\r\n```\r\nのようにすればよいのではないかと思っている。\r\nもっとスマートな書き方があったらすみません。\r\n\r\nそして、labs_controller.rb内で\r\nそれぞれのアクションを設定し直す必要があるのではないかと思ってます。\r\n\r\n```\r\n    def set_lab\r\n      @lab = Lab.find(params[:id])\r\n    end\r\n```\r\n↓かな??? lab_idさえ決まれば、一意に研究室は決まるはずである。edit, update, destroyに関してはauthenticate_lab_user?が設定されているので、ここでidを利用する必要はないのでは？？\r\n```\r\n    def set_lab\r\n      @lab = Lab.find(params[:lab_id])\r\n    end\r\n```\r\n\r\n\r\n```\r\n    # lab に紐づくニュース一覧を取得\r\n    def set_news\r\n      @news = News.where(lab_id: params[:id])\r\n    end\r\n```\r\n↓params[:id]だと、自分のニュースしか取得できなさそうだけど、どうでしょうか？？\r\n```\r\n    # lab に紐づくニュース一覧を取得\r\n    def set_news\r\n      @news = News.where(lab_id: params[:lab_id])\r\n    end\r\n```\r\n\r\n\r\n```\r\n    # lab に紐づくアルバム一覧を取得\r\n    def set_albums\r\n      @albums = Album.where(lab_id: params[:id])\r\n    end\r\n```\r\n↓ニュースと同様\r\n```\r\n    # lab に紐づくアルバム一覧を取得\r\n    def set_albums\r\n      @albums = Album.where(lab_id: params[:lab_id])\r\n    end\r\n```\r\n\r\n\r\n```\r\n    # lab に紐づく研究内容一覧を取得\r\n    def set_works\r\n      @works = Work.where(lab_id: params[:id])\r\n    end\r\n```\r\n↓ニュースと同様\r\n```\r\n    # lab に紐づく研究内容一覧を取得\r\n    def set_works\r\n      @works = Work.where(lab_id: params[:lab_id])\r\n    end\r\n```"},"comment":{"url":"https://api.github.com/repos/premier-spa/research_app/issues/comments/432504871","html_url":"https://github.com/premier-spa/research_app/issues/56#issuecomment-432504871","issue_url":"https://api.github.com/repos/premier-spa/research_app/issues/56","id":432504871,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMjUwNDg3MQ==","user":{"login":"Kuratech5","id":27124851,"node_id":"MDQ6VXNlcjI3MTI0ODUx","avatar_url":"https://avatars2.githubusercontent.com/u/27124851?v=4","gravatar_id":"","url":"https://api.github.com/users/Kuratech5","html_url":"https://github.com/Kuratech5","followers_url":"https://api.github.com/users/Kuratech5/followers","following_url":"https://api.github.com/users/Kuratech5/following{/other_user}","gists_url":"https://api.github.com/users/Kuratech5/gists{/gist_id}","starred_url":"https://api.github.com/users/Kuratech5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kuratech5/subscriptions","organizations_url":"https://api.github.com/users/Kuratech5/orgs","repos_url":"https://api.github.com/users/Kuratech5/repos","events_url":"https://api.github.com/users/Kuratech5/events{/privacy}","received_events_url":"https://api.github.com/users/Kuratech5/received_events","type":"User","site_admin":false},"created_at":"2018-10-24T04:02:43Z","updated_at":"2018-10-24T04:02:43Z","author_association":"CONTRIBUTOR","body":"@hiracky16 \r\nすみません、おれの理解不足でした。\r\n大丈夫そうです。"}}
{"actor":{"display_login":"Kuratech5"}}