Class: CommitsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/commits_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#after_sign_in_path_for, #api_authenticate!, #current_project, #expire_revision!, #followed_projects, #no_cache, #read_revision, #require_login, #return_or_cache_revision!, #revision, #save_current_project, #set_current_project, #unfurling?

Methods included from UrlHelper

#edit_release_path, #edit_release_url, #feature_path, #github_commit_range_url, #github_commit_url, #github_project_url, #github_url?, #goldmine_case_number_url, #link_to_project_feature, #new_release_url, #release_path, #release_url, #releases_path

Instance Method Details

#indexObject



4
5
6
7
8
9
10
11
12
13
# File 'app/controllers/commits_controller.rb', line 4

def index
  commits = Commit.includes(:releases).includes(:committers).includes(:project)

  start_at = params[:start_at].to_time if params[:start_at]
  end_at = params[:end_at].to_time if params[:end_at]
  end_at ||= Time.now if start_at
  commits = commits.during(start_at..end_at) if start_at && end_at

  render json: CommitPresenter.new(commits).verbose
end

#selfObject



15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/commits_controller.rb', line 15

def self
  commits = current_user.commits.includes(:releases).includes(:committers).includes(:project)

  start_at = params[:start_at].to_time if params[:start_at]
  end_at = params[:end_at].to_time if params[:end_at]
  end_at ||= Time.now if start_at
  commits = commits.during(start_at..end_at) if start_at && end_at

  render json: CommitPresenter.new(commits).verbose
end

#showObject



28
29
30
31
# File 'app/controllers/commits_controller.rb', line 28

def show
  @commit = Commit.find_by_sha(params[:sha])
  @project = @commit.project
end