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

24 lines
772 B
Ruby
Raw Normal View History

2014-06-14 21:48:43 +05:30
module Admin
class LodgingsController < Admin::BaseController
2014-08-12 11:51:59 +03:00
load_and_authorize_resource :conference, find_by: :short_title
load_and_authorize_resource :venue, through: :conference, singleton: true
authorize_resource :lodging, through: :venue
2014-06-14 21:48:43 +05:30
def index
2014-08-12 11:51:59 +03:00
authorize! :update, Lodging.new(venue_id: @venue.id)
2014-06-14 21:48:43 +05:30
end
def show; end
2014-06-14 21:48:43 +05:30
def update
if @venue.update_attributes(params[:venue])
redirect_to(admin_conference_lodgings_path(conference_id: @conference.short_title),
notice: 'Lodgings were successfully updated.')
else
redirect_to(admin_conference_lodgings_path(conference_id: @conference.short_title),
notice: 'Updating lodgings failed!')
2014-06-14 21:48:43 +05:30
end
end
end
end