diff options
author | Timothy Andrew <mail@timothyandrew.net> | 2016-09-20 22:17:37 +0300 |
---|---|---|
committer | Timothy Andrew <mail@timothyandrew.net> | 2016-09-20 22:17:37 +0300 |
commit | 918e589c2b29c18d9fe3a8e6c93a3f490c86beb1 (patch) | |
tree | 4b354c178952b4369beb16af43c6b75f9d882c49 /app/models/issue.rb | |
parent | a4a0ce95001b93c2ed65a18946542f3eecdf564e (diff) |
Implement a second round of review comments from @DouweM.
- Don't use `TableReferences` - using `.arel_table` is shorter!
- Move some database-related code to `Gitlab::Database`
- Remove the `MergeRequest#issues_closed` and
`Issue#closed_by_merge_requests` associations. They were either
shadowing or were too similar to existing methods. They are not being
used anywhere, so it's better to remove them to reduce confusion.
- Use Rails 3-style validations
- Index for `MergeRequest::Metrics#first_deployed_to_production_at`
- Only include `CycleAnalyticsHelpers::TestGeneration` for specs that
need it.
- Other minor refactorings.
Diffstat (limited to 'app/models/issue.rb')
-rw-r--r-- | app/models/issue.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb index 6a264ace165..25ba38a1cff 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -24,7 +24,6 @@ class Issue < ActiveRecord::Base has_many :events, as: :target, dependent: :destroy has_many :merge_requests_closing_issues, class_name: 'MergeRequestsClosingIssues' - has_many :closed_by_merge_requests, through: :merge_requests_closing_issues, source: :merge_request validates :project, presence: true @@ -39,6 +38,8 @@ class Issue < ActiveRecord::Base scope :order_due_date_asc, -> { reorder('issues.due_date IS NULL, issues.due_date ASC') } scope :order_due_date_desc, -> { reorder('issues.due_date IS NULL, issues.due_date DESC') } + scope :created_after, -> (datetime) { where("created_at >= ?", datetime) } + attr_spammable :title, spam_title: true attr_spammable :description, spam_description: true |