Module: BelongsToCommit::ClassMethods

Defined in:
app/concerns/belongs_to_commit.rb

Instance Method Summary collapse

Instance Method Details

#find_by_sha(sha) ⇒ Object



15
16
17
# File 'app/concerns/belongs_to_commit.rb', line 15

def find_by_sha(sha)
  with_sha_like(sha).first if sha
end

#find_by_sha!(sha) ⇒ Object



11
12
13
# File 'app/concerns/belongs_to_commit.rb', line 11

def find_by_sha!(sha)
  find_by_sha(sha) || raise(ActiveRecord::RecordNotFound)
end

#with_sha_like(sha) ⇒ Object



19
20
21
# File 'app/concerns/belongs_to_commit.rb', line 19

def with_sha_like(sha)
  where(["sha LIKE ?", "#{sha.strip}%"])
end