Skip to content

Instantly share code, notes, and snippets.

@mholubowski
Created September 12, 2013 19:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mholubowski/6542700 to your computer and use it in GitHub Desktop.
Save mholubowski/6542700 to your computer and use it in GitHub Desktop.
NotificationSubscription.where(confirmed: true)
.joins(property: :feedback_inputs)
.where("feedback_inputs.created_at >= :cutoff", {cutoff: 1.hour.ago})
@mholubowski
Copy link
Author

Is there a way to make :cutoff dynamic, depending on a column in NotificationSubscription?

So {cutoff: NotificationSubscription.last_email_sent_at}

@andrewberls
Copy link

Well right now you have no tie to a user - is that what you're asking about?

@mholubowski
Copy link
Author

NotificationSubscription.where(confirmed: true)
.joins(property: :feedback_inputs)
.where("feedback_inputs.created_at >= :cutoff", {cutoff: {notification_subscription: :last_email_sent_at}})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment