Files
osem/app/controllers/admin/volunteers_controller.rb
Chrisbr fbda757e70 Replaced find_all_by through find_by
Find_by_all is removed in Rails 4.1
2014-04-27 16:27:29 +02:00

26 lines
975 B
Ruby

class Admin::VolunteersController < ApplicationController
def index
@conference = Conference.find_by(short_title: params[:conference_id])
render :index
end
def show
@conference = Conference.find_by(short_title: params[:conference_id])
if @conference.use_vpositions
@volunteers = @conference.registrations.joins(:vchoices).uniq
else
@volunteers = @conference.registrations.where(:volunteer => true)
end
end
def update
@conference = Conference.find_by(short_title: params[:conference_id])
begin
@conference.update_attributes!(params[:conference])
redirect_to(admin_conference_volunteers_info_path(:conference_id => params[:conference_id]), :notice => "Volunteering options were successfully updated.")
rescue Exception => e
redirect_to(admin_conference_volunteers_info_path(:conference_id => params[:conference_id]), :alert => "Volunteering options update failed: #{e.message}")
end
end
end