Class: Notches::Time

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/notches/time.rb

Class Method Summary collapse

Class Method Details

.find_or_create_by_time(time) ⇒ Object



7
8
9
# File 'app/models/notches/time.rb', line 7

def self.find_or_create_by_time(time)
  where("time(time) = ?", time.strftime("%H:%M:%S")).first.presence || create(time: time)
end