diff --git a/.env.development b/.env.development index 41bc1e2..95a7332 100644 --- a/.env.development +++ b/.env.development @@ -20,7 +20,7 @@ MYSQL_DATABASE=ensl MYSQL_USERNAME=ensl MYSQL_PASSWORD=ensl MYSQL_ROOT_PASSWORD=ensl -MYSQL_CONNECTION_POOL=8 +MYSQL_CONNECTION_POOL=32 NEW_RELIC_APP_NAME=ENSL NEW_RELIC_LICENSE_KEY= diff --git a/app/controllers/teams_controller.rb b/app/controllers/teams_controller.rb index 6cf409e..4bdf0d6 100644 --- a/app/controllers/teams_controller.rb +++ b/app/controllers/teams_controller.rb @@ -39,6 +39,7 @@ class TeamsController < ApplicationController def update raise AccessError unless @team.can_update? cuser if @team.update_attributes(Team.params(params, cuser)) + # FIXME: move this logic to model if params[:rank] @team.teamers.present.each do |member| # Contains new rank as given by submitted parameters diff --git a/app/controllers/weeks_controller.rb b/app/controllers/weeks_controller.rb index 65ada05..104f58f 100644 --- a/app/controllers/weeks_controller.rb +++ b/app/controllers/weeks_controller.rb @@ -12,7 +12,7 @@ class WeeksController < ApplicationController end def create - @week = Week.new(Weeks.params(params, cuser)) + @week = Week.new(Week.params(params, cuser)) raise AccessError unless @week.can_create? cuser if @week.save diff --git a/app/models/article.rb b/app/models/article.rb index 783746c..9c4f80d 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -54,7 +54,8 @@ class Article < ActiveRecord::Base scope :nodrafts, -> { where(status: STATUS_PUBLISHED) } scope :drafts, -> { where(status: STATUS_DRAFT) } scope :articles, -> { where(["category_id IN (SELECT id FROM categories WHERE domain = ?)", Category::DOMAIN_ARTICLES]) } - scope :onlynews, -> { where(category_id: Category.select(:id).where.not(domain: Category::DOMAIN_NEWS)) } + # FIXME: shorter + scope :onlynews, -> { where(category_id: Category.select(:id).where(domain: Category::DOMAIN_NEWS)) } scope :category, -> (cat) { where(category_id: cat) } scope :domain, -> (domain) { includes(:category).where("categories.domain = '?'", domain) } #scope :nospecial, -> { where("category_id != ?", Category::SPECIAL) } diff --git a/app/models/team.rb b/app/models/team.rb index 611e1da..838b0fa 100644 --- a/app/models/team.rb +++ b/app/models/team.rb @@ -133,6 +133,6 @@ class Team < ActiveRecord::Base end def self.params(params, cuser) - params.require(:team).except(:id, :active, :founder_id, :created_at, :updated_at).permit! + params.permit(:team).except(:id, :active, :founder_id, :created_at, :updated_at).permit! end end diff --git a/app/views/contests/show.html.erb b/app/views/contests/show.html.erb index 758c73c..e61fe73 100644 --- a/app/views/contests/show.html.erb +++ b/app/views/contests/show.html.erb @@ -22,7 +22,7 @@ <%= link_to 'Scheduled Matches', confirmed_matches_path(@contest), class: 'button' %> - <% if cuser and cuser.admin? %> + <% if @contest.can_update?(cuser) %> <%= link_to 'Edit Contest', edit_contest_path(@contest), class: 'button' %> <% end %>