This commit is contained in:
Stella Rouzi 2015-10-17 16:57:48 +03:00
parent 2e692f7ea5
commit 01086813af
37 changed files with 221 additions and 190 deletions

View file

@ -13,8 +13,8 @@ module Admin
def create
@lodging = @conference.lodgings.new(lodging_params)
if @lodging.save
redirect_to(admin_conference_lodgings_path(conference_id: @conference.short_title),
notice: 'Lodging successfully created.')
flash[:notice] = 'Lodging successfully created.'
redirect_to admin_conference_lodgings_path(conference_id: @conference.short_title)
else
flash[:error] = "Creating Lodging failed: #{@lodging.errors.full_messages.join('. ')}."
render :new
@ -25,8 +25,8 @@ module Admin
def update
if @lodging.update_attributes(lodging_params)
redirect_to(admin_conference_lodgings_path(conference_id: @conference.short_title),
notice: 'Lodging successfully updated.')
flash[:notice] = 'Lodging successfully updated.'
redirect_to admin_conference_lodgings_path(conference_id: @conference.short_title)
else
flash[:error] = "Update Lodging failed: #{@lodging.errors.full_messages.join('. ')}."
render :edit
@ -35,12 +35,12 @@ module Admin
def destroy
if @lodging.destroy
redirect_to(admin_conference_lodgings_path(conference_id: @conference.short_title),
notice: 'Lodging successfully deleted.')
flash[:notice] = 'Lodging successfully deleted.'
redirect_to admin_conference_lodgings_path(conference_id: @conference.short_title)
else
redirect_to(admin_conference_lodgings_path(conference_id: @conference.short_title),
error: 'Deleting lodging failed.' \
"#{@lodging.errors.full_messages.join('. ')}.")
flash[:error] = 'Deleting lodging failed.' \
"#{@lodging.errors.full_messages.join('. ')}."
redirect_to admin_conference_lodgings_path(conference_id: @conference.short_title)
end
end