2014-08-06 21:14:00 +03:00
|
|
|
module Admin
|
2014-08-13 14:37:05 +03:00
|
|
|
class DietchoicesController < Admin::BaseController
|
2014-08-12 11:51:59 +03:00
|
|
|
load_and_authorize_resource :conference, find_by: :short_title
|
|
|
|
|
load_and_authorize_resource :dietary_choice, through: :conference
|
2013-02-02 16:43:47 +01:00
|
|
|
|
2014-08-06 21:14:00 +03:00
|
|
|
def show
|
|
|
|
|
render :diets_list
|
|
|
|
|
end
|
2013-02-02 16:43:47 +01:00
|
|
|
|
2014-08-06 21:14:00 +03:00
|
|
|
def update
|
|
|
|
|
begin
|
|
|
|
|
@conference.update_attributes!(params[:conference])
|
2014-08-12 15:54:53 +03:00
|
|
|
redirect_to(admin_conference_dietary_list_path(conference_id: @conference.short_title), notice: 'Dietary choices were successfully updated.')
|
2014-08-06 21:14:00 +03:00
|
|
|
rescue => e
|
2014-08-12 15:54:53 +03:00
|
|
|
redirect_to(admin_conference_dietary_list_path(conference_id: @conference.short_title), alert: "Dietary choices update failed: #{e.message}")
|
2014-08-06 21:14:00 +03:00
|
|
|
end
|
2013-02-02 16:43:47 +01:00
|
|
|
end
|
|
|
|
|
end
|
2014-06-30 17:07:53 +02:00
|
|
|
end
|