Use only new hash syntax

This commit is contained in:
Artem Chernikov 2014-07-21 14:49:05 +02:00
parent 3901973fd6
commit 5289f41eb5
72 changed files with 179 additions and 181 deletions

View file

@ -8,9 +8,9 @@ class Admin::DietchoicesController < ApplicationController
def update
begin
@conference.update_attributes!(params[:conference])
redirect_to(admin_conference_dietary_list_path(:conference_id => @conference.short_title), :notice => 'Dietary choices were successfully updated.')
redirect_to(admin_conference_dietary_list_path(conference_id: @conference.short_title), notice: 'Dietary choices were successfully updated.')
rescue => e
redirect_to(admin_conference_dietary_list_path(:conference_id => @conference.short_title), :alert => "Dietary choices update failed: #{e.message}")
redirect_to(admin_conference_dietary_list_path(conference_id: @conference.short_title), alert: "Dietary choices update failed: #{e.message}")
end
end
end

View file

@ -12,18 +12,18 @@ class Admin::DifficultyLevelsController < ApplicationController
@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))
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))
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))
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))
redirect_to(admin_conference_difficulty_levels_path(conference_id: @conference.short_title))
end
end
end

View file

@ -3,7 +3,7 @@ class Admin::QuestionsController < ApplicationController
def index
@conference = Conference.find_by(short_title: params[:conference_id])
@questions = Question.where(:global => true).all | Question.where(:conference_id => @conference.id)
@questions = Question.where(global: true).all | Question.where(conference_id: @conference.id)
@questions_conference = @conference.questions
@new_question = @conference.questions.new
end
@ -34,7 +34,7 @@ class Admin::QuestionsController < ApplicationController
@question = Question.find(params[:id])
if @question.global == true && !has_role?(current_user, "Admin")
redirect_to(admin_conference_questions_path(:conference_id => @conference.short_title), :alert => "Sorry, you cannot edit global questions. Create a new one.")
redirect_to(admin_conference_questions_path(conference_id: @conference.short_title), alert: "Sorry, you cannot edit global questions. Create a new one.")
end
end
@ -45,9 +45,9 @@ class Admin::QuestionsController < ApplicationController
@question = Question.find(params[:id])
if @question.update_attributes(params[:question])
redirect_to(admin_conference_questions_path(:conference_id => @conference.short_title), :notice => "Question '#{@question.title}' for #{@conference.short_title} successfully updated.")
redirect_to(admin_conference_questions_path(conference_id: @conference.short_title), notice: "Question '#{@question.title}' for #{@conference.short_title} successfully updated.")
else
redirect_to(admin_conference_questions_path(:conference_id => @conference.short_title), :notice => "Update of questions for #{@conference.short_title} failed.")
redirect_to(admin_conference_questions_path(conference_id: @conference.short_title), notice: "Update of questions for #{@conference.short_title} failed.")
end
end
@ -56,9 +56,9 @@ class Admin::QuestionsController < ApplicationController
@conference = Conference.find_by(short_title: params[:conference_id])
if @conference.update_attributes(params[:conference])
redirect_to(admin_conference_questions_path(:conference_id => @conference.short_title), :notice => "Questions for #{@conference.short_title} successfully updated.")
redirect_to(admin_conference_questions_path(conference_id: @conference.short_title), notice: "Questions for #{@conference.short_title} successfully updated.")
else
redirect_to(admin_conference_questions_path(:conference_id => @conference.short_title), :notice => "Update of questions for #{@conference.short_title} failed.")
redirect_to(admin_conference_questions_path(conference_id: @conference.short_title), notice: "Update of questions for #{@conference.short_title} failed.")
end
end
@ -90,7 +90,7 @@ class Admin::QuestionsController < ApplicationController
flash[:error] = "You must be an admin to delete a question."
end
@questions = Question.where(:global => true).all | Question.where(:conference_id => @conference.id)
@questions = Question.where(global: true).all | Question.where(conference_id: @conference.id)
@questions_conference = @conference.questions
end
end

View file

@ -7,9 +7,9 @@ class Admin::SocialEventsController < ApplicationController
def update
if @conference.update_attributes(params[:conference])
redirect_to(admin_conference_social_events_path(:conference_id => @conference.short_title), :notice => 'Social events were successfully updated.')
redirect_to(admin_conference_social_events_path(conference_id: @conference.short_title), notice: 'Social events were successfully updated.')
else
redirect_to(admin_conference_social_events_path(:conference_id => @conference.short_title), :notice => 'Social events update failed.')
redirect_to(admin_conference_social_events_path(conference_id: @conference.short_title), notice: 'Social events update failed.')
end
end
end

View file

@ -8,9 +8,9 @@ class Admin::SupporterLevelsController < ApplicationController
def update
begin
@conference.update_attributes!(params[:conference])
redirect_to(admin_conference_supporter_levels_path(:conference_id => @conference.short_title), :notice => 'Supporter levels were successfully updated.')
redirect_to(admin_conference_supporter_levels_path(conference_id: @conference.short_title), notice: 'Supporter levels were successfully updated.')
rescue => e
redirect_to(admin_conference_supporter_levels_path(:conference_id => @conference.short_title), :alert => "Supporter levels update failed: #{e.message}")
redirect_to(admin_conference_supporter_levels_path(conference_id: @conference.short_title), alert: "Supporter levels update failed: #{e.message}")
end
end
end

View file

@ -11,6 +11,6 @@ class Admin::SupportersController < ApplicationController
def create
params[:supporter_registration][:conference_id] = @conference.id
SupporterRegistration.create!(params[:supporter_registration])
redirect_to(admin_conference_supporters_path(:conference_id => @conference.short_title), :notice => "Supporter added")
redirect_to(admin_conference_supporters_path(conference_id: @conference.short_title), notice: "Supporter added")
end
end

View file

@ -9,7 +9,7 @@ class Admin::VolunteersController < ApplicationController
if @conference.use_vpositions
@volunteers = @conference.registrations.joins(:vchoices).uniq
else
@volunteers = @conference.registrations.where(:volunteer => true)
@volunteers = @conference.registrations.where(volunteer: true)
end
end
@ -17,9 +17,9 @@ class Admin::VolunteersController < ApplicationController
@conference = Conference.find_by(short_title: params[:conference_id])
begin
@conference.update_attributes!(params[:conference])
redirect_to(admin_conference_volunteers_info_path(:conference_id => params[:conference_id]), :notice => "Volunteering options were successfully updated.")
redirect_to(admin_conference_volunteers_info_path(conference_id: params[:conference_id]), notice: "Volunteering options were successfully updated.")
rescue => e
redirect_to(admin_conference_volunteers_info_path(:conference_id => params[:conference_id]), :alert => "Volunteering options update failed: #{e.message}")
redirect_to(admin_conference_volunteers_info_path(conference_id: params[:conference_id]), alert: "Volunteering options update failed: #{e.message}")
end
end
end

View file

@ -7,6 +7,6 @@ class Api::V1::ConferencesController < Api::BaseController
else
conferences = Conference.find_all_by_guid(params[:conference_id])
end
render :json => conferences, :serializer => ConferencesArraySerializer
render json: conferences, serializer: ConferencesArraySerializer
end
end

View file

@ -70,7 +70,7 @@ class ApplicationController < ActionController::Base
rescue_from CanCan::AccessDenied do |exception|
Rails.logger.debug("Access denied!")
redirect_to root_path, :alert => exception.message
redirect_to root_path, alert: exception.message
end
helper_method :organizer_or_admin?

View file

@ -1,6 +1,6 @@
class EventAttachmentsController < ApplicationController
before_filter :verify_user
skip_before_filter :verify_user, :only => [:show]
skip_before_filter :verify_user, only: [:show]
def index
@proposal = Event.find(params[:proposal_id])
@ -67,9 +67,9 @@ class EventAttachmentsController < ApplicationController
respond_to do |format|
if @upload.save
format.html {
render :json => [@upload.to_jq_upload].to_json,
:content_type => 'text/html',
:layout => false
render json: [@upload.to_jq_upload].to_json,
content_type: 'text/html',
layout: false
}
format.json do
render json: [@upload.to_jq_upload].to_json, status: :created,
@ -108,7 +108,7 @@ class EventAttachmentsController < ApplicationController
respond_to do |format|
format.html { redirect_back_or_to conference_proposal_index_path(@conference.short_title), :notice => "Deleted successfully attachment '#{@upload.title}' for proposal '#{@proposal.title}'" }
format.html { redirect_back_or_to conference_proposal_index_path(@conference.short_title), notice: "Deleted successfully attachment '#{@upload.title}' for proposal '#{@proposal.title}'" }
format.json { head :no_content }
end

View file

@ -2,7 +2,7 @@ class ScheduleController < ApplicationController
layout "application"
def index
@conference = Conference.includes(:rooms, {:events => [:speakers, :track, :event_type]}).where("conferences.short_title" => params[:conference_id]).first
@conference = Conference.includes(:rooms, {events: [:speakers, :track, :event_type]}).where("conferences.short_title" => params[:conference_id]).first
@rooms = @conference.rooms
@events = @conference.events
@dates = @conference.start_date..@conference.end_date