{"action":"created","issue":{"url":"https://api.github.com/repos/cpjk/canary/issues/29","labels_url":"https://api.github.com/repos/cpjk/canary/issues/29/labels{/name}","comments_url":"https://api.github.com/repos/cpjk/canary/issues/29/comments","events_url":"https://api.github.com/repos/cpjk/canary/issues/29/events","html_url":"https://github.com/cpjk/canary/issues/29","id":120090026,"number":29,"title":"Allowing loading of resource on :new and :create actions.","user":{"login":"jordantdavis","id":3215984,"avatar_url":"https://avatars.githubusercontent.com/u/3215984?v=3","gravatar_id":"","url":"https://api.github.com/users/jordantdavis","html_url":"https://github.com/jordantdavis","followers_url":"https://api.github.com/users/jordantdavis/followers","following_url":"https://api.github.com/users/jordantdavis/following{/other_user}","gists_url":"https://api.github.com/users/jordantdavis/gists{/gist_id}","starred_url":"https://api.github.com/users/jordantdavis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jordantdavis/subscriptions","organizations_url":"https://api.github.com/users/jordantdavis/orgs","repos_url":"https://api.github.com/users/jordantdavis/repos","events_url":"https://api.github.com/users/jordantdavis/events{/privacy}","received_events_url":"https://api.github.com/users/jordantdavis/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-12-03T04:01:10Z","updated_at":"2015-12-15T17:40:29Z","closed_at":null,"body":"If someone fetches a resource when the action is :new or :create, then they get nil back every time.  \r\n\r\nIf we have a nested resource such as:\r\n\r\n```\r\n/api/v1/questions/:question_id/answers\r\n```\r\n\r\nwhere questions are owned by users, then we can never load and/or authorize a resource on these creation actions.\r\n\r\nShould we allow resources to be loaded on :new and :create actions so we can deal with nested resources?  Thoughts?"},"comment":{"url":"https://api.github.com/repos/cpjk/canary/issues/comments/164837560","html_url":"https://github.com/cpjk/canary/issues/29#issuecomment-164837560","issue_url":"https://api.github.com/repos/cpjk/canary/issues/29","id":164837560,"user":{"login":"jordantdavis","id":3215984,"avatar_url":"https://avatars.githubusercontent.com/u/3215984?v=3","gravatar_id":"","url":"https://api.github.com/users/jordantdavis","html_url":"https://github.com/jordantdavis","followers_url":"https://api.github.com/users/jordantdavis/followers","following_url":"https://api.github.com/users/jordantdavis/following{/other_user}","gists_url":"https://api.github.com/users/jordantdavis/gists{/gist_id}","starred_url":"https://api.github.com/users/jordantdavis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jordantdavis/subscriptions","organizations_url":"https://api.github.com/users/jordantdavis/orgs","repos_url":"https://api.github.com/users/jordantdavis/repos","events_url":"https://api.github.com/users/jordantdavis/events{/privacy}","received_events_url":"https://api.github.com/users/jordantdavis/received_events","type":"User","site_admin":false},"created_at":"2015-12-15T17:40:29Z","updated_at":"2015-12-15T17:40:29Z","body":"One more thing I ran into while adding the persisted option.  Can we use the persisted option to override the default for :index actions (fetch_all)?\r\n\r\nSo we'd have something like this:\r\n```\r\nplug load_and_authorize_resource [model: Question, id_name: \"question_id\", persisted: true, preload: :answers] when action in [:index]\r\n```\r\n\r\nAnd it would load/authorize that Question resource, then preload its associated Answers.\r\n\r\nWhat do you think?  It's an easy addition on my end."}}