diff --git a/app/controllers/admin/conference_controller.rb b/app/controllers/admin/conference_controller.rb index 7bc5fe79..0027ff77 100644 --- a/app/controllers/admin/conference_controller.rb +++ b/app/controllers/admin/conference_controller.rb @@ -23,7 +23,7 @@ class Admin::ConferenceController < ApplicationController end def update - @conference = Conference.find_all_by_short_title(params[:id]).first + @conference = Conference.find_by(short_title: params[:id]) @conference.update_attributes(params[:conference]) flash[:notice] = "Updated Conference" redirect_to(admin_conference_path(:id => @conference.short_title), :notice => 'Conference was successfully updated.') @@ -31,7 +31,7 @@ class Admin::ConferenceController < ApplicationController def show @conferences = Conference.all - @conference = Conference.find_all_by_short_title(params[:id]).first + @conference = Conference.find_by(short_title: params[:id]) respond_to do |format| format.html format.json { render :json => @conference.to_json } diff --git a/app/controllers/admin/difficulty_levels_controller.rb b/app/controllers/admin/difficulty_levels_controller.rb index 6b500ac1..8c9b7701 100644 --- a/app/controllers/admin/difficulty_levels_controller.rb +++ b/app/controllers/admin/difficulty_levels_controller.rb @@ -2,7 +2,7 @@ class Admin::DifficultyLevelsController < ApplicationController before_filter :verify_organizer def index - @conference = Conference.find_all_by_short_title(params[:conference_id]).first + @conference = Conference.find_by(short_title: params[:conference_id]) end def update diff --git a/app/controllers/admin/questions_controller.rb b/app/controllers/admin/questions_controller.rb index 7cac1e0e..edaf35d7 100644 --- a/app/controllers/admin/questions_controller.rb +++ b/app/controllers/admin/questions_controller.rb @@ -2,19 +2,19 @@ class Admin::QuestionsController < ApplicationController before_filter :verify_organizer def index - @conference = Conference.find_all_by_short_title(params[:conference_id]).first + @conference = Conference.find_by(short_title: params[:conference_id]) @questions = Question.where(:global => true).all | Question.where(:conference_id => @conference.id) @questions_conference = @conference.questions @new_question = @conference.questions.new end def new - @conference = Conference.find_all_by_short_title(params[:conference_id]).first + @conference = Conference.find_by(short_title: params[:conference_id]) @new_question = @conference.questions.new end def create - @conference = Conference.find_all_by_short_title(params[:conference_id]).first + @conference = Conference.find_by(short_title: params[:conference_id]) @question = @conference.questions.new(params[:question]) @question.conference_id = @conference.id @@ -30,7 +30,7 @@ class Admin::QuestionsController < ApplicationController # GET questions/1/edit def edit - @conference = Conference.find_all_by_short_title(params[:conference_id]).first + @conference = Conference.find_by(short_title: params[:conference_id]) @question = Question.find(params[:id]) if @question.global == true && !has_role?(current_user, "Admin") @@ -41,7 +41,7 @@ class Admin::QuestionsController < ApplicationController # PUT questions/1 def update - @conference = Conference.find_all_by_short_title(params[:conference_id]).first + @conference = Conference.find_by(short_title: params[:conference_id]) @question = Question.find(params[:id]) if @question.update_attributes(params[:question]) @@ -53,7 +53,7 @@ class Admin::QuestionsController < ApplicationController # Update questions used for the conference def update_conference - @conference = Conference.find_all_by_short_title(params[:conference_id]).first + @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.") diff --git a/app/controllers/admin/registrations_controller.rb b/app/controllers/admin/registrations_controller.rb index 8eebf85f..91b2992f 100644 --- a/app/controllers/admin/registrations_controller.rb +++ b/app/controllers/admin/registrations_controller.rb @@ -53,11 +53,11 @@ class Admin::RegistrationsController < ApplicationController @person = Person.new @registration = @person.registrations.new @supporter_registration = @conference.supporter_registrations.new - @conference = Conference.find_all_by_short_title(params[:conference_id]).first + @conference = Conference.find_by(short_title: params[:conference_id]) end def create - @conference = Conference.find_all_by_short_title(params[:conference_id]).first + @conference = Conference.find_by(short_title: params[:conference_id]) email = params[:registration][:person].delete(:user)[:email] @person = Person.find_by_email email @registration = nil diff --git a/app/controllers/admin/volunteers_controller.rb b/app/controllers/admin/volunteers_controller.rb index 739f1990..0da1f31f 100644 --- a/app/controllers/admin/volunteers_controller.rb +++ b/app/controllers/admin/volunteers_controller.rb @@ -1,11 +1,11 @@ class Admin::VolunteersController < ApplicationController def index - @conference = Conference.find_all_by_short_title(params[:conference_id]).first + @conference = Conference.find_by(short_title: params[:conference_id]) render :index end def show - @conference = Conference.find_all_by_short_title(params[:conference_id]).first + @conference = Conference.find_by(short_title: params[:conference_id]) if @conference.use_vpositions @volunteers = @conference.registrations.joins(:vchoices).uniq else @@ -14,7 +14,7 @@ class Admin::VolunteersController < ApplicationController end def update - @conference = Conference.find_all_by_short_title(params[:conference_id]).first + @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.") diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 7023fbcb..077f2073 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -30,7 +30,7 @@ class ApplicationController < ActionController::Base return false end - @conference = Conference.find_all_by_short_title(params[:conference_id]).first + @conference = Conference.find_by(short_title: params[:conference_id]) true end diff --git a/app/controllers/conference_registration_controller.rb b/app/controllers/conference_registration_controller.rb index 4e692022..c8379d61 100644 --- a/app/controllers/conference_registration_controller.rb +++ b/app/controllers/conference_registration_controller.rb @@ -3,7 +3,7 @@ class ConferenceRegistrationController < ApplicationController def register # TODO Figure out how to change the route's id from :id to :conference_id - @conference = Conference.find_all_by_short_title(params[:id]).first + @conference = Conference.find_by(short_title: params[:id]).first @workshops = @conference.events.where("require_registration = ? AND state LIKE ?", true, 'confirmed') @person = current_user.person if @person.first_name.blank? || @person.last_name.blank? @@ -24,7 +24,7 @@ class ConferenceRegistrationController < ApplicationController # TODO this is ugly def update - conference = Conference.find_all_by_short_title(params[:id]).first + conference = Conference.find_by(short_title: params[:id]) person = current_user.person registration = person.registrations.where(:conference_id => conference.id).first update_registration = true @@ -80,7 +80,7 @@ class ConferenceRegistrationController < ApplicationController end def unregister - conference = Conference.find_all_by_short_title(params[:id]).first + conference = Conference.find_by(short_title: params[:id]) person = current_user.person registration = person.registrations.where(:conference_id => conference.id).first registration.destroy diff --git a/app/controllers/proposal_controller.rb b/app/controllers/proposal_controller.rb index 6d252830..9234d885 100644 --- a/app/controllers/proposal_controller.rb +++ b/app/controllers/proposal_controller.rb @@ -7,7 +7,7 @@ class ProposalController < ApplicationController @person = current_user.person if current_user #FIXME: @conference also comes from verify_user, but we need setup also in show # which can be accessed anonymusly - @conference = Conference.find_all_by_short_title(params[:conference_id]).first + @conference = Conference.find_by(short_title: params[:conference_id]) @url = conference_proposal_index_path(@conference.short_title) @event_types = @conference.event_types end