File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed
Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change 33class AllocationsController < ApplicationController
44 def show
55 @fund = Fund . find_by ( slug : params [ :fund_id ] )
6- @allocation = @fund . allocations . find ( params [ :id ] )
6+ @allocation = @fund . allocations . find_by ( slug : params [ :id ] )
77 @project_allocations = @allocation . project_allocations . includes ( :project , :funding_source ) . order ( 'amount_cents desc' ) . where ( 'amount_cents >= 1' )
88 end
99
@@ -35,7 +35,7 @@ def export
3535
3636 def export_github_sponsors
3737 @fund = Fund . find_by ( slug : params [ :fund_id ] )
38- @allocation = @fund . allocations . find ( params [ :id ] )
38+ @allocation = @fund . allocations . find_by ( slug : params [ :id ] )
3939
4040 csv_data = @allocation . github_sponsors_csv_export
4141
Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ class Allocation < ApplicationRecord
77 scope :displayable , -> { where ( 'funded_projects_count > 0' ) }
88 scope :completed , -> { where . not ( completed_at : nil ) }
99
10+ validates_uniqueness_of :slug , scope : :fund_id
11+
1012 before_create :set_slug
1113
1214 def to_s
You can’t perform that action at this time.
0 commit comments