Class: Commit

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

Instance Method Summary collapse

Instance Method Details

#find_or_create(options = {}) ⇒ Object



9
10
11
12
# File 'app/models/commit.rb', line 9

def find_or_create(options={})
  commit = Commit.where(:sha => options[:sha]).first
  !commit.blank? ? commit : Commit.create!(options)
end