Commit c4a212323d4809d220cb4fabd0d500f1113a4492
1 parent
ab681ed7
Exists in
master
and in
1 other branch
Issue has_one issue_tracker
Showing
1 changed file
with
5 additions
and
9 deletions
Show diff stats
app/models/issue.rb
| 1 | class Issue | 1 | class Issue |
| 2 | include ActiveModel::Model | 2 | include ActiveModel::Model |
| 3 | - attr_accessor :problem, :user, :title, :body | 3 | + attr_accessor :issue_tracker, :user, :title, :body |
| 4 | 4 | ||
| 5 | - def intialize(problem: nil, user: nil, title: nil, body: nil) | ||
| 6 | - @problem, @user, @title, @body = problem, user, title, body | 5 | + def intialize(issue_tracker: nil, user: nil, title: nil, body: nil) |
| 6 | + @issue_tracker, @user, @title, @body = issue_tracker, user, title, body | ||
| 7 | end | 7 | end |
| 8 | 8 | ||
| 9 | def save | 9 | def save |
| 10 | - if tracker | ||
| 11 | - tracker.create_issue(title, body, user.as_document) | 10 | + if issue_tracker |
| 11 | + issue_tracker.create_issue(title, body, user.as_document) | ||
| 12 | else | 12 | else |
| 13 | errors.add :base, "This app has no issue tracker setup." | 13 | errors.add :base, "This app has no issue tracker setup." |
| 14 | end | 14 | end |
| @@ -17,8 +17,4 @@ class Issue | @@ -17,8 +17,4 @@ class Issue | ||
| 17 | errors.add :base, "There was an error during issue creation: #{ex.message}" | 17 | errors.add :base, "There was an error during issue creation: #{ex.message}" |
| 18 | false | 18 | false |
| 19 | end | 19 | end |
| 20 | - | ||
| 21 | - def tracker | ||
| 22 | - problem.app.issue_tracker | ||
| 23 | - end | ||
| 24 | end | 20 | end |