{"action":"created","issue":{"url":"https://api.github.com/repos/rdgifford/dds/issues/3","labels_url":"https://api.github.com/repos/rdgifford/dds/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/rdgifford/dds/issues/3/comments","events_url":"https://api.github.com/repos/rdgifford/dds/issues/3/events","html_url":"https://github.com/rdgifford/dds/pull/3","id":106274382,"number":3,"title":"Shifts","user":{"login":"rdgifford","id":13399300,"avatar_url":"https://avatars.githubusercontent.com/u/13399300?v=3","gravatar_id":"","url":"https://api.github.com/users/rdgifford","html_url":"https://github.com/rdgifford","followers_url":"https://api.github.com/users/rdgifford/followers","following_url":"https://api.github.com/users/rdgifford/following{/other_user}","gists_url":"https://api.github.com/users/rdgifford/gists{/gist_id}","starred_url":"https://api.github.com/users/rdgifford/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rdgifford/subscriptions","organizations_url":"https://api.github.com/users/rdgifford/orgs","repos_url":"https://api.github.com/users/rdgifford/repos","events_url":"https://api.github.com/users/rdgifford/events{/privacy}","received_events_url":"https://api.github.com/users/rdgifford/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-09-14T05:38:58Z","updated_at":"2015-09-14T21:50:15Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/rdgifford/dds/pulls/3","html_url":"https://github.com/rdgifford/dds/pull/3","diff_url":"https://github.com/rdgifford/dds/pull/3.diff","patch_url":"https://github.com/rdgifford/dds/pull/3.patch"},"body":"@jonahgeorge\r\nI'm working in the shift model and controller to establish a single shift per night. Right now I've got it so the work_path establishes a new shift every time it's accessed--that's a step in the right direction, but I'd like to be sure a shift is only initiated by the first user of the night. My thinking was from here I would establish validations to ensure a shift could only be created between working hours. Then the shift controllers logic would only create a new shift if a valid shift wasn't already in existence, otherwise a redirect would send the user to the show action for the current shift. What I'm wondering is first off generally--excuse my code exploding everywhere, I've been clumsily tinkering--is this an efficient way to go about setting up shifts? Then second of all, validations on shifts will only effect shifts about to be created, right? I mean, if my database is populated with invalid shifts, the model won't care, right?"},"comment":{"url":"https://api.github.com/repos/rdgifford/dds/issues/comments/140215266","html_url":"https://github.com/rdgifford/dds/pull/3#issuecomment-140215266","issue_url":"https://api.github.com/repos/rdgifford/dds/issues/3","id":140215266,"user":{"login":"rdgifford","id":13399300,"avatar_url":"https://avatars.githubusercontent.com/u/13399300?v=3","gravatar_id":"","url":"https://api.github.com/users/rdgifford","html_url":"https://github.com/rdgifford","followers_url":"https://api.github.com/users/rdgifford/followers","following_url":"https://api.github.com/users/rdgifford/following{/other_user}","gists_url":"https://api.github.com/users/rdgifford/gists{/gist_id}","starred_url":"https://api.github.com/users/rdgifford/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rdgifford/subscriptions","organizations_url":"https://api.github.com/users/rdgifford/orgs","repos_url":"https://api.github.com/users/rdgifford/repos","events_url":"https://api.github.com/users/rdgifford/events{/privacy}","received_events_url":"https://api.github.com/users/rdgifford/received_events","type":"User","site_admin":false},"created_at":"2015-09-14T21:50:15Z","updated_at":"2015-09-14T21:50:15Z","body":"Alright, so that plan of attack would require a button_to in place of the link_to on the application view. The validations on the time of shift will still be necessary—shifts shouldn’t be created outside of working hours. Preventing rides from building up without a shift—that’s something I hadn’t even thought about. How about preventing duplicate shifts though, whether a link or a button a validation has to be enforced for that, right? I guess I'm confused. What moving parts does a button shave off? Is using a button not just a reconfiguration of the same parts that a link to the shift_path (with post method) uses?"}}