enable style ClassAndModuleChildren

This commit is contained in:
Stella Rouzi 2014-08-06 21:14:00 +03:00
parent 2f814c7320
commit 1c1391c69e
15 changed files with 475 additions and 448 deletions

View file

@ -1,29 +1,31 @@
class Admin::DifficultyLevelsController < ApplicationController
before_filter :verify_organizer
def index
@conference = Conference.find_by(short_title: params[:conference_id])
end
module Admin
class DifficultyLevelsController < ApplicationController
before_filter :verify_organizer
def update
if @conference.update_attributes(params[:conference])
if !(@conference.difficulty_levels.count > 0) && @conference.use_difficulty_levels == true
begin
@conference.use_difficulty_levels = false
@conference.save!
flash[:error] = "You cannot enable the usage of difficulty levels without having set any levels."
def index
@conference = Conference.find_by(short_title: params[:conference_id])
end
def update
if @conference.update_attributes(params[:conference])
if !(@conference.difficulty_levels.count > 0) && @conference.use_difficulty_levels == true
begin
@conference.use_difficulty_levels = false
@conference.save!
flash[:error] = "You cannot enable the usage of difficulty levels without having set any levels."
redirect_to(admin_conference_difficulty_levels_path(conference_id: @conference.short_title))
rescue ActiveRecord::RecordInvalid
flash[:error] = "Something went wrong. Difficulty Levels update failed."
redirect_to(admin_conference_difficulty_levels_path(conference_id: @conference.short_title))
end
else
flash[:notice] = "Difficulty Levels were successfully updated."
redirect_to(admin_conference_difficulty_levels_path(conference_id: @conference.short_title))
rescue ActiveRecord::RecordInvalid
flash[:error] = "Something went wrong. Difficulty Levels update failed."
redirect_to(admin_conference_difficulty_levels_path(conference_id: @conference.short_title))
end
else
flash[:notice] = "Difficulty Levels were successfully updated."
flash[:error] = "Difficulty Levels update failed."
redirect_to(admin_conference_difficulty_levels_path(conference_id: @conference.short_title))
end
else
flash[:error] = "Difficulty Levels update failed."
redirect_to(admin_conference_difficulty_levels_path(conference_id: @conference.short_title))
end
end
end