Commit 606701ada4076b963439983a5633535108d81f0f
1 parent
625fb2f2
Exists in
master
and in
4 other branches
Look for milestone by iid in milestone controller
Showing
2 changed files
with
2 additions
and
1 deletions
Show diff stats
app/controllers/projects/milestones_controller.rb
| @@ -81,7 +81,7 @@ class Projects::MilestonesController < Projects::ApplicationController | @@ -81,7 +81,7 @@ class Projects::MilestonesController < Projects::ApplicationController | ||
| 81 | protected | 81 | protected |
| 82 | 82 | ||
| 83 | def milestone | 83 | def milestone |
| 84 | - @milestone ||= @project.milestones.find(params[:id]) | 84 | + @milestone ||= @project.milestones.find_by_iid!(params[:id]) |
| 85 | end | 85 | end |
| 86 | 86 | ||
| 87 | def authorize_admin_milestone! | 87 | def authorize_admin_milestone! |
spec/models/milestone_spec.rb
| @@ -25,6 +25,7 @@ describe Milestone do | @@ -25,6 +25,7 @@ describe Milestone do | ||
| 25 | end | 25 | end |
| 26 | 26 | ||
| 27 | describe "Validation" do | 27 | describe "Validation" do |
| 28 | + before { subject.stub(set_iid: false) } | ||
| 28 | it { should validate_presence_of(:title) } | 29 | it { should validate_presence_of(:title) } |
| 29 | it { should validate_presence_of(:project) } | 30 | it { should validate_presence_of(:project) } |
| 30 | end | 31 | end |