{"action":"created","issue":{"url":"https://api.github.com/repos/ga-dc/project4/issues/67","labels_url":"https://api.github.com/repos/ga-dc/project4/issues/67/labels{/name}","comments_url":"https://api.github.com/repos/ga-dc/project4/issues/67/comments","events_url":"https://api.github.com/repos/ga-dc/project4/issues/67/events","html_url":"https://github.com/ga-dc/project4/issues/67","id":125679853,"number":67,"title":"Question on ActionMailer ","user":{"login":"jacohen10","id":7953656,"avatar_url":"https://avatars.githubusercontent.com/u/7953656?v=3","gravatar_id":"","url":"https://api.github.com/users/jacohen10","html_url":"https://github.com/jacohen10","followers_url":"https://api.github.com/users/jacohen10/followers","following_url":"https://api.github.com/users/jacohen10/following{/other_user}","gists_url":"https://api.github.com/users/jacohen10/gists{/gist_id}","starred_url":"https://api.github.com/users/jacohen10/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacohen10/subscriptions","organizations_url":"https://api.github.com/users/jacohen10/orgs","repos_url":"https://api.github.com/users/jacohen10/repos","events_url":"https://api.github.com/users/jacohen10/events{/privacy}","received_events_url":"https://api.github.com/users/jacohen10/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-01-08T19:44:33Z","updated_at":"2016-01-08T19:50:38Z","closed_at":null,"body":"I'm curious if I used a conditional and then deliver_later, would the conditional be checked right away or when the delay was executed. \r\n\r\nSo for example: \r\n\r\n```rb\r\nclass UsersController < ApplicationController\r\n  def create\r\n    @user = User.new(params[:user])\r\n    if @user.email == true \r\n     UserMailer.welcome_user(@user).deliver_later(wait: 5.minute)\r\n    end\r\n  end\r\nend\r\n```\r\n\r\nNow that I'm writing this out I'm pretty sure it'll check it right away and send if the conditional is true even if it changes before those 5 minutes have expired.\r\n\r\nIs using the sleep method a way around this? Such as:\r\n\r\n```rb\r\nclass UsersController < ApplicationController\r\n  def create\r\n    @user = User.new(params[:user])\r\n    sleep(5.minutes)\r\n    if @user.email == true \r\n     UserMailer.welcome_user(@user).deliver_later(wait: 5.minute)\r\n    end\r\n  end\r\nend\r\n```\r\nI now realize I should just test this out on my own... sorry\r\n\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/ga-dc/project4/issues/comments/170105628","html_url":"https://github.com/ga-dc/project4/issues/67#issuecomment-170105628","issue_url":"https://api.github.com/repos/ga-dc/project4/issues/67","id":170105628,"user":{"login":"RobertAKARobin","id":6268177,"avatar_url":"https://avatars.githubusercontent.com/u/6268177?v=3","gravatar_id":"","url":"https://api.github.com/users/RobertAKARobin","html_url":"https://github.com/RobertAKARobin","followers_url":"https://api.github.com/users/RobertAKARobin/followers","following_url":"https://api.github.com/users/RobertAKARobin/following{/other_user}","gists_url":"https://api.github.com/users/RobertAKARobin/gists{/gist_id}","starred_url":"https://api.github.com/users/RobertAKARobin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RobertAKARobin/subscriptions","organizations_url":"https://api.github.com/users/RobertAKARobin/orgs","repos_url":"https://api.github.com/users/RobertAKARobin/repos","events_url":"https://api.github.com/users/RobertAKARobin/events{/privacy}","received_events_url":"https://api.github.com/users/RobertAKARobin/received_events","type":"User","site_admin":false},"created_at":"2016-01-08T19:50:38Z","updated_at":"2016-01-08T19:50:38Z","body":"Ruby executes everything in the order in which it appears, so if you have `sleep` before the conditional, then it'll sleep before evaluating the conditional."}}