impress/app/controllers/campaigns_controller.rb

21 lines
448 B
Ruby
Raw Normal View History

2015-08-05 16:26:12 -07:00
class CampaignsController < ApplicationController
def show
@campaign = Campaign.find(params[:id])
redirect_to(action: :current) if @campaign.active?
@donations = find_donations
end
def current
@campaign = Campaign.current
@donations = find_donations
render action: :show
end
private
def find_donations
@donations = @campaign.donations.includes(features: :outfit).
order('created_at DESC')
end
end