osem-fcy/app/controllers/admin/dietchoices_controller.rb

20 lines
697 B
Ruby
Raw Normal View History

2014-08-06 21:14:00 +03:00
module Admin
class DietchoicesController < ApplicationController
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
2014-08-06 21:14:00 +03:00
def show
render :diets_list
end
2014-08-06 21:14:00 +03:00
def update
begin
@conference.update_attributes!(params[:conference])
2014-08-12 11:51:59 +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 11:51:59 +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
end
end
2014-06-30 17:07:53 +02:00
end