Skip to content

Instantly share code, notes, and snippets.

@rafapolo
Last active December 17, 2015 03:48
Show Gist options
  • Save rafapolo/5545564 to your computer and use it in GitHub Desktop.
Save rafapolo/5545564 to your computer and use it in GitHub Desktop.
class Ponto
...
before_save :detect_overgain
def detect_overgain
return false if Ponto.where(:identidade_id=>self.identidade.id).where('created_at > ?', 1.day.ago).where(:motivo=>self.motivo).count > 0
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment