diff --git a/app/controllers/nonprofits/campaign_templates_controller.rb b/app/controllers/nonprofits/campaign_templates_controller.rb index 8188900e..49804707 100644 --- a/app/controllers/nonprofits/campaign_templates_controller.rb +++ b/app/controllers/nonprofits/campaign_templates_controller.rb @@ -6,8 +6,8 @@ module Nonprofits before_filter :authenticate_nonprofit_user!, only: [:index, :show] def index - @templates = CampaignTemplate.all @nonprofit = current_nonprofit + @templates = @nonprofit.campaign_templates end def create diff --git a/app/models/campaign_template.rb b/app/models/campaign_template.rb index 21d0bcd6..4d72b717 100644 --- a/app/models/campaign_template.rb +++ b/app/models/campaign_template.rb @@ -17,7 +17,8 @@ class CampaignTemplate < ActiveRecord::Base :summary, :body, :end_datetime, - :goal_customizable + :goal_customizable, + :nonprofit_id attr_accessor :goal_amount_dollars attr_accessor :goal_customizable diff --git a/app/models/nonprofit.rb b/app/models/nonprofit.rb index 421b59b1..2d512444 100755 --- a/app/models/nonprofit.rb +++ b/app/models/nonprofit.rb @@ -62,6 +62,7 @@ class Nonprofit < ActiveRecord::Base has_many :supporter_notes, through: :supporters has_many :profiles, through: :donations has_many :campaigns, dependent: :destroy + has_many :campaign_templates, dependent: :destroy has_many :events, dependent: :destroy has_many :tickets, through: :events has_many :users, through: :roles diff --git a/app/views/nonprofits/campaign_templates/_new_modal.html.erb b/app/views/nonprofits/campaign_templates/_new_modal.html.erb index c8640896..6fba6cb8 100644 --- a/app/views/nonprofits/campaign_templates/_new_modal.html.erb +++ b/app/views/nonprofits/campaign_templates/_new_modal.html.erb @@ -18,7 +18,7 @@