mirror of
https://github.com/ENSL/ensl.org.git
synced 2025-01-26 03:01:00 +00:00
Lots of rails 4 updates
- Add .params to models and update controllers - Add afk time to gather - Reannotate models - Fix rspec problem by using latest rspec plugins from github
This commit is contained in:
parent
76faa4d18c
commit
e59e8ac8e7
89 changed files with 991 additions and 453 deletions
10
Gemfile
10
Gemfile
|
@ -38,6 +38,7 @@ gem 'dynamic_form'
|
|||
gem 'public_suffix'
|
||||
gem 'sanitize'
|
||||
gem 'will_paginate'
|
||||
gem 'time_difference'
|
||||
|
||||
# External APIs
|
||||
gem 'google-api-client', '~> 0.10.3'
|
||||
|
@ -94,8 +95,6 @@ group :test do
|
|||
gem 'factory_bot_rails', '4.10.0'
|
||||
gem 'phantomjs', require: 'phantomjs/poltergeist'
|
||||
gem 'poltergeist'
|
||||
gem 'rspec'
|
||||
gem 'rspec-rails'
|
||||
gem 'selenium-webdriver'
|
||||
# Fix FF issue
|
||||
gem 'geckodriver-helper'
|
||||
|
@ -104,6 +103,13 @@ group :test do
|
|||
gem 'simplecov', require: false
|
||||
gem 'test-unit'
|
||||
gem 'timecop'
|
||||
|
||||
# Use dev versions because of rspec bug
|
||||
gem 'rspec-core', git: 'https://github.com/rspec/rspec-core'
|
||||
gem 'rspec-expectations', git: 'https://github.com/rspec/rspec-expectations'
|
||||
gem 'rspec-mocks', git: 'https://github.com/rspec/rspec-mocks'
|
||||
gem 'rspec-rails', git: 'https://github.com/rspec/rspec-rails'
|
||||
gem 'rspec-support', git: 'https://github.com/rspec/rspec-support'
|
||||
end
|
||||
|
||||
group :development, :test do
|
||||
|
|
73
Gemfile.lock
73
Gemfile.lock
|
@ -6,6 +6,48 @@ GIT
|
|||
multi_json (~> 1.6)
|
||||
multi_xml (~> 0.5)
|
||||
|
||||
GIT
|
||||
remote: https://github.com/rspec/rspec-core
|
||||
revision: 725b0d2eadaa9ac9f816a6d2d7ef1e507a6705cd
|
||||
specs:
|
||||
rspec-core (3.10.0.pre)
|
||||
rspec-support (= 3.10.0.pre)
|
||||
|
||||
GIT
|
||||
remote: https://github.com/rspec/rspec-expectations
|
||||
revision: 3c997d98f49731b2d28d01e070b88aef6bb3c68b
|
||||
specs:
|
||||
rspec-expectations (3.10.0.pre)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (= 3.10.0.pre)
|
||||
|
||||
GIT
|
||||
remote: https://github.com/rspec/rspec-mocks
|
||||
revision: 81c17e89b2722cb225d602e08b600e4a4f6148a4
|
||||
specs:
|
||||
rspec-mocks (3.10.0.pre)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (= 3.10.0.pre)
|
||||
|
||||
GIT
|
||||
remote: https://github.com/rspec/rspec-rails
|
||||
revision: 84e79259c8978fdff34ea2a327316b638ff00b85
|
||||
specs:
|
||||
rspec-rails (4.0.0.pre)
|
||||
actionpack (>= 4.2)
|
||||
activesupport (>= 4.2)
|
||||
railties (>= 4.2)
|
||||
rspec-core (= 3.10.0.pre)
|
||||
rspec-expectations (= 3.10.0.pre)
|
||||
rspec-mocks (= 3.10.0.pre)
|
||||
rspec-support (= 3.10.0.pre)
|
||||
|
||||
GIT
|
||||
remote: https://github.com/rspec/rspec-support
|
||||
revision: 9cec8e858228ee1d1395e4e6186ac39c2a83d705
|
||||
specs:
|
||||
rspec-support (3.10.0.pre)
|
||||
|
||||
GEM
|
||||
remote: http://rubygems.org/
|
||||
specs:
|
||||
|
@ -306,27 +348,6 @@ GEM
|
|||
retriable (3.1.2)
|
||||
rexml (3.2.4)
|
||||
rmagick (4.0.0)
|
||||
rspec (3.9.0)
|
||||
rspec-core (~> 3.9.0)
|
||||
rspec-expectations (~> 3.9.0)
|
||||
rspec-mocks (~> 3.9.0)
|
||||
rspec-core (3.9.1)
|
||||
rspec-support (~> 3.9.1)
|
||||
rspec-expectations (3.9.1)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.9.0)
|
||||
rspec-mocks (3.9.1)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.9.0)
|
||||
rspec-rails (3.9.1)
|
||||
actionpack (>= 3.0)
|
||||
activesupport (>= 3.0)
|
||||
railties (>= 3.0)
|
||||
rspec-core (~> 3.9.0)
|
||||
rspec-expectations (~> 3.9.0)
|
||||
rspec-mocks (~> 3.9.0)
|
||||
rspec-support (~> 3.9.0)
|
||||
rspec-support (3.9.2)
|
||||
rubocop (0.80.1)
|
||||
jaro_winkler (~> 1.5.1)
|
||||
parallel (~> 1.10)
|
||||
|
@ -384,6 +405,8 @@ GEM
|
|||
thor (1.0.1)
|
||||
thread_safe (0.3.6)
|
||||
tilt (2.0.10)
|
||||
time_difference (0.5.0)
|
||||
activesupport
|
||||
timecop (0.9.1)
|
||||
tinymce-rails (5.2.0)
|
||||
railties (>= 3.1.1)
|
||||
|
@ -454,8 +477,11 @@ DEPENDENCIES
|
|||
rake (< 11.0)
|
||||
responders
|
||||
rmagick
|
||||
rspec
|
||||
rspec-rails
|
||||
rspec-core!
|
||||
rspec-expectations!
|
||||
rspec-mocks!
|
||||
rspec-rails!
|
||||
rspec-support!
|
||||
rubocop
|
||||
sanitize
|
||||
sass-rails (~> 5.0.3)
|
||||
|
@ -465,6 +491,7 @@ DEPENDENCIES
|
|||
spring (= 2.0.2)
|
||||
steam-condenser!
|
||||
test-unit
|
||||
time_difference
|
||||
timecop
|
||||
tinymce-rails
|
||||
uglifier (~> 2.5.0)
|
||||
|
|
|
@ -53,7 +53,7 @@ class ArticlesController < ApplicationController
|
|||
|
||||
def update
|
||||
raise AccessError unless @article.can_update? cuser, Article.article_params(params, cuser)
|
||||
if @article.update_attributes(article_params)
|
||||
if @article.update_attributes(Article.article_params(params, cuser))
|
||||
flash[:notice] = t(:articles_update)
|
||||
redirect_to @article
|
||||
else
|
||||
|
|
|
@ -18,7 +18,7 @@ class BansController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
@ban = Ban.new(params[:ban])
|
||||
@ban = Ban.new(Ban.params(params, cuser))
|
||||
raise AccessError unless @ban.can_create? cuser
|
||||
@ban.creator = cuser
|
||||
|
||||
|
@ -32,7 +32,7 @@ class BansController < ApplicationController
|
|||
|
||||
def update
|
||||
raise AccessError unless @ban.can_update? cuser
|
||||
if @ban.update_attributes(ban_params(ban_params))
|
||||
if @ban.update_attributes(Ban.params(params, cuser))
|
||||
flash[:notice] = t(:bans_update)
|
||||
redirect_to(@ban)
|
||||
else
|
||||
|
@ -51,8 +51,4 @@ class BansController < ApplicationController
|
|||
def get_ban
|
||||
@ban = Ban.find(params[:id])
|
||||
end
|
||||
|
||||
def ban_params
|
||||
params.permit(:steamid, :user_id, :addr, :server_id, :expiry, :reason, :ban_type, :ip)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,7 +7,7 @@ class BracketsController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
@bracket = Bracket.new params[:bracket]
|
||||
@bracket = Bracket.new Bracket.params(params, cuser)
|
||||
raise AccessError unless @bracket.can_create? cuser
|
||||
|
||||
if @bracket.save
|
||||
|
@ -20,7 +20,7 @@ class BracketsController < ApplicationController
|
|||
def update
|
||||
raise AccessError unless @bracket.can_update? cuser
|
||||
|
||||
if @bracket.update_attributes params[:bracket] and @bracket.update_cells(params[:cell])
|
||||
if @bracket.update_attributes(Bracket.params(params, cuser)) and @bracket.update_cells(params.permit(:cell)[:cell])
|
||||
flash[:notice] = t(:brackets_update)
|
||||
end
|
||||
|
||||
|
|
|
@ -23,10 +23,11 @@ class CategoriesController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
@category = Category.new params[:category]
|
||||
@category = Category.new Category.params(params, cuser)
|
||||
raise AccessError unless @category.can_create? cuser
|
||||
|
||||
if @category.save
|
||||
# FIXME: move to model
|
||||
@category.update_attribute :sort, @category.id
|
||||
flash[:notice] = t(:articles_category)
|
||||
redirect_to :categories
|
||||
|
@ -37,7 +38,7 @@ class CategoriesController < ApplicationController
|
|||
|
||||
def update
|
||||
raise AccessError unless @category.can_update? cuser
|
||||
if @category.update_attributes params[:category]
|
||||
if @category.update_attributes Category.params(params, cuser)
|
||||
flash[:notice] = t(:articles_category_update)
|
||||
redirect_to :categories
|
||||
end
|
||||
|
|
|
@ -29,7 +29,7 @@ class ChallengesController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
@challenge = Challenge.new params[:challenge]
|
||||
@challenge = Challenge.new(Challenge.params(params, cuser))
|
||||
@challenge.user = cuser
|
||||
raise AccessError unless @challenge.can_create? cuser
|
||||
|
||||
|
@ -55,7 +55,7 @@ class ChallengesController < ApplicationController
|
|||
@challenge.status = Challenge::STATUS_DECLINED
|
||||
end
|
||||
|
||||
if @challenge.update_attributes params[:challenge]
|
||||
if @challenge.update_attributes(Challenge.params(params, cuser))
|
||||
flash[:notice] = t(:challenges_update)
|
||||
end
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ class CommentsController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
@comment = Comment.new params[:comment]
|
||||
@comment = Comment.new Comment.params(parmas, cuser)
|
||||
@comment.user = cuser
|
||||
raise AccessError unless @comment.can_create? cuser
|
||||
|
||||
|
@ -33,7 +33,7 @@ class CommentsController < ApplicationController
|
|||
|
||||
def update
|
||||
raise AccessError unless @comment.can_update? cuser
|
||||
if @comment.update_attributes params[:comment]
|
||||
if @comment.update_attributes(Comment.params(parmas, cuser))
|
||||
flash[:notice] = t(:comments_update)
|
||||
return_to
|
||||
else
|
||||
|
|
|
@ -19,7 +19,7 @@ class ContestersController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
@contester = Contester.new params[:contester]
|
||||
@contester = Contester.new(Contester.params(params, cuser))
|
||||
@contester.user = cuser
|
||||
raise AccessError unless @contester.can_create? cuser
|
||||
if @contester.contest.contest_type == Contest::TYPE_LADDER
|
||||
|
@ -48,7 +48,7 @@ class ContestersController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
if @contester.update_attributes params[:contester]
|
||||
if @contester.update_attributes(Contester.params(params, cuser))
|
||||
flash[:notice] = t(:contests_contester_update)
|
||||
redirect_to @contester.contest
|
||||
else
|
||||
|
|
|
@ -53,7 +53,7 @@ class ContestsController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
@contest = Contest.new params[:contest]
|
||||
@contest = Contest.new(Contest.params(params, cuser))
|
||||
raise AccessError unless @contest.can_create? cuser
|
||||
|
||||
if @contest.save
|
||||
|
@ -67,7 +67,7 @@ class ContestsController < ApplicationController
|
|||
def update
|
||||
raise AccessError unless @contest.can_update? cuser
|
||||
if update_type == "contest"
|
||||
if @contest.update_attributes(params[:contest])
|
||||
if @contest.update_attributes(Contest.params(params, cuser))
|
||||
flash[:notice] = t(:contests_update)
|
||||
redirect_to @contest
|
||||
else
|
||||
|
|
|
@ -27,7 +27,7 @@ class DataFilesController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
@file = DataFile.new params[:data_file]
|
||||
@file = DataFile.new(DataFile.params(params, cuser))
|
||||
@file.size = 0
|
||||
raise AccessError unless @file.can_create? cuser
|
||||
|
||||
|
@ -47,7 +47,7 @@ class DataFilesController < ApplicationController
|
|||
|
||||
def update
|
||||
raise AccessError unless @file.can_update? cuser
|
||||
if @file.update_attributes params[:data_file]
|
||||
if @file.update_attributes(DataFile.params(params, cuser))
|
||||
flash[:notice] = t(:files_update)
|
||||
redirect_to(@file)
|
||||
else
|
||||
|
|
|
@ -26,7 +26,7 @@ class DirectoriesController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
@directory = Directory.new params[:directory]
|
||||
@directory = Directory.new(Directory.params(params, cuser))
|
||||
raise AccessError unless @directory.can_create? cuser
|
||||
|
||||
if @directory.save
|
||||
|
@ -39,7 +39,7 @@ class DirectoriesController < ApplicationController
|
|||
|
||||
def update
|
||||
raise AccessError unless @directory.can_update? cuser
|
||||
if @directory.update_attributes(params[:directory])
|
||||
if @directory.update_attributes(Directory.params(params, cuser))
|
||||
flash[:notice] = t(:directories_update)
|
||||
redirect_to @directory
|
||||
else
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class ForumersController < ApplicationController
|
||||
def create
|
||||
@forumer = Forumer.new params[:forumer]
|
||||
@forumer = Forumer.new(Forumer.params(params, cuser))
|
||||
raise AccessError unless @forumer.can_create? cuser
|
||||
|
||||
if @forumer.save
|
||||
|
@ -16,7 +16,7 @@ class ForumersController < ApplicationController
|
|||
@forumer = Forumer.find params[:id]
|
||||
raise AccessError unless @forumer.can_update? cuser
|
||||
|
||||
if @forumer.update_attributes params[:forumer]
|
||||
if @forumer.update_attributes(Forumer.params(params, cuser))
|
||||
flash[:notice] = t(:groups_acl_update)
|
||||
else
|
||||
flash[:error] = @forumer.errors.full_messages.to_s
|
||||
|
|
|
@ -31,7 +31,7 @@ class ForumsController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
@forum = Forum.new(params[:forum])
|
||||
@forum = Forum.new(Forum.params(params, cuser))
|
||||
raise AccessError unless @forum.can_create? cuser
|
||||
|
||||
if @forum.save
|
||||
|
@ -44,7 +44,7 @@ class ForumsController < ApplicationController
|
|||
|
||||
def update
|
||||
raise AccessError unless @forum.can_update? cuser
|
||||
if @forum.update_attributes(params[:forum])
|
||||
if @forum.update_attributes(Forum.params(params, cuser))
|
||||
flash[:notice] = t(:forums_update)
|
||||
redirect_to(@forum)
|
||||
else
|
||||
|
|
|
@ -4,9 +4,9 @@ class GatherersController < ApplicationController
|
|||
def create
|
||||
Gather.transaction do
|
||||
Gatherer.transaction do
|
||||
@gatherer = Gatherer.new params[:gatherer]
|
||||
@gatherer = Gatherer.new(Gatherer.params(params, cuser))
|
||||
@gatherer.gather.lock!
|
||||
raise AccessError unless @gatherer.can_create? cuser, params[:gatherer]
|
||||
raise AccessError unless @gatherer.can_create?(cuser, Gatherer.params(params, cuser))
|
||||
|
||||
if @gatherer.save
|
||||
flash[:notice] = t(:gathers_join)
|
||||
|
@ -21,9 +21,9 @@ class GatherersController < ApplicationController
|
|||
|
||||
def update
|
||||
@gatherer = Gatherer.find params[:gatherer][:id]
|
||||
raise AccessError unless @gatherer.can_update? cuser, params[:gatherer]
|
||||
raise AccessError unless @gatherer.can_update?(cuser, Gatherer.params(params, cuser))
|
||||
|
||||
if @gatherer.update_attributes params[:gatherer]
|
||||
if @gatherer.update_attributes(Gatherer.params(params, cuser))
|
||||
flash[:notice] = t(:gatherers_update)
|
||||
else
|
||||
flash[:error] = @gatherer.errors.full_messages.to_s
|
||||
|
|
|
@ -37,7 +37,7 @@ class GathersController < ApplicationController
|
|||
|
||||
Gatherer.transaction do
|
||||
Gather.transaction do
|
||||
if @gather.update_attributes params[:gather]
|
||||
if @gather.update_attributes(Gather.params(params, cuser))
|
||||
flash[:notice] = 'Gather was successfully updated.'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class GroupersController < ApplicationController
|
||||
def create
|
||||
@grouper = Grouper.new params[:grouper]
|
||||
@grouper = Grouper.new(Grouper.params(params, cuser))
|
||||
raise AccessError unless @grouper.can_create? cuser
|
||||
|
||||
if @grouper.save
|
||||
|
@ -16,7 +16,7 @@ class GroupersController < ApplicationController
|
|||
@grouper = Grouper.find params[:id]
|
||||
raise AccessError unless @grouper.can_update? cuser
|
||||
|
||||
if @grouper.update_attributes params[:grouper]
|
||||
if @grouper.update_attributes(Grouper.params(params, cuser))
|
||||
flash[:notice] = t(:groups_user_update)
|
||||
else
|
||||
flash[:error] = @grouper.errors.full_messages.to_s
|
||||
|
|
|
@ -19,7 +19,7 @@ class GroupsController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
@group = Group.new params[:group]
|
||||
@group = Group.new(Group.params(params, cuser))
|
||||
@group.founder = cuser
|
||||
raise AccessError unless @group.can_create? cuser
|
||||
if @group.save
|
||||
|
@ -32,7 +32,7 @@ class GroupsController < ApplicationController
|
|||
|
||||
def update
|
||||
raise AccessError unless @group.can_update? cuser
|
||||
if @group.update_attributes params[:group]
|
||||
if @group.update_attributes(Group.params(params, cuser))
|
||||
flash[:notice] = t(:groups_update)
|
||||
redirect_to @group
|
||||
else
|
||||
|
|
|
@ -36,7 +36,7 @@ class IssuesController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
@issue = Issue.new(params[:issue])
|
||||
@issue = Issue.new(Issue.params(params, cuser))
|
||||
@issue.author = cuser if cuser
|
||||
raise AccessError unless @issue.can_create? cuser
|
||||
|
||||
|
@ -54,7 +54,7 @@ class IssuesController < ApplicationController
|
|||
|
||||
def update
|
||||
raise AccessError unless @issue.can_update?(cuser, params[:issue])
|
||||
if @issue.update_attributes(params[:issue])
|
||||
if @issue.update_attributes(Issue.params(params, cuser))
|
||||
flash[:notice] = t(:issues_update)
|
||||
redirect_to(@issue)
|
||||
else
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class LocksController < ApplicationController
|
||||
def create
|
||||
@lock = Lock.new params[:lock]
|
||||
@lock = Lock.new(Lock.params(params, cuser))
|
||||
raise AccessError unless @lock.can_create? cuser
|
||||
|
||||
if @lock.save
|
||||
|
|
|
@ -18,7 +18,7 @@ class MapsController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
@map = Map.new params[:map]
|
||||
@map = Map.new(Map.params(params, cuser))
|
||||
raise AccessError unless @map.can_create? cuser
|
||||
|
||||
if @map.save
|
||||
|
@ -31,7 +31,7 @@ class MapsController < ApplicationController
|
|||
|
||||
def update
|
||||
raise AccessError unless @map.can_update? cuser
|
||||
if @map.update_attributes(params[:map])
|
||||
if @map.update_attributes(Map.params(params, cuser))
|
||||
flash[:notice] = t(:maps_update)
|
||||
redirect_to @map
|
||||
else
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
class MatchProposalsController < ApplicationController
|
||||
before_action :get_match
|
||||
|
||||
def index
|
||||
raise AccessError unless cuser.admin? || @match.user_in_match?(cuser)
|
||||
end
|
||||
|
@ -19,7 +20,7 @@ class MatchProposalsController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
@proposal = MatchProposal.new(params[:match_proposal])
|
||||
@proposal = MatchProposal.new(MatchProposal.params(params, cuser))
|
||||
@proposal.match = @match
|
||||
raise AccessError unless @proposal.can_create? cuser
|
||||
@proposal.team = cuser.team
|
||||
|
@ -49,7 +50,7 @@ class MatchProposalsController < ApplicationController
|
|||
}
|
||||
render(json: rjson, status: :not_found) && return
|
||||
end
|
||||
unless proposal.can_update?(cuser, params[:match_proposal])
|
||||
unless proposal.can_update?(cuser, MatchProposal.params(params, cuser))
|
||||
rjson[:error] = {
|
||||
code: 403,
|
||||
message: "You are not allowed to update the state to #{MatchProposal.status_strings[params[:match_proposal][:status].to_i]}"
|
||||
|
|
|
@ -6,7 +6,7 @@ class MatchesController < ApplicationController
|
|||
end
|
||||
|
||||
def show
|
||||
@ownpred = @match.predictions.first conditions: { user_id: cuser.id } if cuser
|
||||
@ownpred = @match.predictions.where(user_id: cuser.id) if cuser
|
||||
@newpred = @match.predictions.build
|
||||
end
|
||||
|
||||
|
@ -35,7 +35,7 @@ class MatchesController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
@match = Match.new params[:match]
|
||||
@match = Match.new(Match.params(params, cuser))
|
||||
raise AccessError unless @match.can_create? cuser
|
||||
|
||||
if @match.save
|
||||
|
@ -59,7 +59,7 @@ class MatchesController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
if @match.update_attributes params[:match]
|
||||
if @match.update_attributes(Match.params(params, cuser))
|
||||
respond_to do |format|
|
||||
format.xml { head :ok }
|
||||
format.html do
|
||||
|
|
|
@ -29,7 +29,7 @@ class MessagesController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
@message = Message.new(params[:message])
|
||||
@message = Message.new(Message.params(params, cuser))
|
||||
@message.sender = @message.sender_raw == "" ? cuser : cuser.active_teams.find(@message.sender_raw)
|
||||
raise AccessError unless @message.can_create? cuser
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ class MoviesController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
@movie = Movie.new(params[:movie])
|
||||
@movie = Movie.new(Movie.params(params, cuser))
|
||||
raise AccessError unless @movie.can_create? cuser
|
||||
|
||||
if @movie.save
|
||||
|
@ -39,7 +39,7 @@ class MoviesController < ApplicationController
|
|||
def update
|
||||
raise AccessError unless @movie.can_update? cuser
|
||||
|
||||
if @movie.update_attributes(params[:movie])
|
||||
if @movie.update_attributes(Movie.params(params, cuser))
|
||||
flash[:notice] = t(:movies_update)
|
||||
redirect_to(@movie)
|
||||
else
|
||||
|
|
|
@ -6,7 +6,7 @@ class PollsController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
@poll = Poll.new params[:poll]
|
||||
@poll = Poll.new(Poll.params(params, cuser))
|
||||
@poll.user = cuser
|
||||
raise AccessError unless @poll.can_create? cuser
|
||||
|
||||
|
@ -21,7 +21,7 @@ class PollsController < ApplicationController
|
|||
def update
|
||||
raise AccessError unless @poll.can_update? cuser
|
||||
|
||||
if @poll.update_attributes params[:poll]
|
||||
if @poll.update_attributes(Poll.params(params, cuser))
|
||||
flash[:notice] = t(:polls_update)
|
||||
redirect_to @poll
|
||||
else
|
||||
|
|
|
@ -19,7 +19,7 @@ class PollsController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
@poll = Poll.new params[:poll]
|
||||
@poll = Poll.new(Poll.params(params, cuser))
|
||||
@poll.user = cuser
|
||||
raise AccessError unless @poll.can_create? cuser
|
||||
|
||||
|
@ -34,7 +34,7 @@ class PollsController < ApplicationController
|
|||
def update
|
||||
raise AccessError unless @poll.can_update? cuser
|
||||
|
||||
if @poll.update_attributes params[:poll]
|
||||
if @poll.update_attributes(Poll.params(params, cuser))
|
||||
flash[:notice] = t(:polls_update)
|
||||
redirect_to @poll
|
||||
else
|
||||
|
|
|
@ -19,7 +19,7 @@ class PostsController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
@post = Post.new(params[:post])
|
||||
@post = Post.new(Post.params(params, cuser))
|
||||
@post.user = cuser
|
||||
raise AccessError unless @post.can_create? cuser
|
||||
|
||||
|
@ -36,7 +36,7 @@ class PostsController < ApplicationController
|
|||
|
||||
def update
|
||||
raise AccessError unless @post.can_update? cuser, params[:post]
|
||||
if @post.update_attributes(params[:post])
|
||||
if @post.update_attributes(Post.params(params, cuser))
|
||||
flash[:notice] = t(:posts_update)
|
||||
redirect_to @post.topic
|
||||
else
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class PredictionsController < ApplicationController
|
||||
def create
|
||||
@prediction = Prediction.new params[:prediction]
|
||||
@prediction = Prediction.new(Prediction.params(params, cuser))
|
||||
@prediction.user = cuser
|
||||
raise AccessError unless @prediction.can_create? cuser
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ class ServersController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
@server = Server.new params[:server]
|
||||
@server = Server.new(Server.params(params, cuser))
|
||||
@server.user = cuser
|
||||
raise AccessError unless @server.can_create? cuser
|
||||
|
||||
|
@ -35,7 +35,7 @@ class ServersController < ApplicationController
|
|||
def update
|
||||
raise AccessError unless @server.can_update? cuser
|
||||
|
||||
if @server.update_attributes params[:server]
|
||||
if @server.update_attributes(Server.params(params, cuser))
|
||||
flash[:notice] = t(:server_update)
|
||||
redirect_to @server
|
||||
else
|
||||
|
|
|
@ -14,7 +14,7 @@ class ShoutmsgsController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
@shoutmsg = Shoutmsg.new params[:shoutmsg]
|
||||
@shoutmsg = Shoutmsg.new(Shoutmsg.params(params, cuser))
|
||||
@shoutmsg.user = cuser
|
||||
raise AccessError unless @shoutmsg.can_create? cuser
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ class TeamersController < ApplicationController
|
|||
|
||||
def create
|
||||
@old_application = (cuser.teamers.joining.count == 0) ? nil : cuser.teamers.joining.first
|
||||
@teamer = Teamer.new params[:teamer]
|
||||
raise AccessError unless @teamer.can_create? cuser, params[:teamer]
|
||||
@teamer = Teamer.new(Teamer.params(params, cuser))
|
||||
raise AccessError unless @teamer.can_create?(cuser, Teamer.params(params, cuser))
|
||||
@teamer.user = cuser unless cuser.admin?
|
||||
|
||||
if @teamer.save
|
||||
|
|
|
@ -24,7 +24,7 @@ class TeamsController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
@team = Team.new params[:team]
|
||||
@team = Team.new(Team.params(params, cuser))
|
||||
@team.founder = cuser
|
||||
raise AccessError unless @team.can_create? cuser
|
||||
|
||||
|
@ -38,7 +38,7 @@ class TeamsController < ApplicationController
|
|||
|
||||
def update
|
||||
raise AccessError unless @team.can_update? cuser
|
||||
if @team.update_attributes params[:team]
|
||||
if @team.update_attributes(Team.params(params, cuser))
|
||||
if params[:rank]
|
||||
@team.teamers.present.each do |member|
|
||||
# Contains new rank as given by submitted parameters
|
||||
|
|
|
@ -42,7 +42,7 @@ class TopicsController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
@topic = Topic.new(params[:topic])
|
||||
@topic = Topic.new(Topic.params(params, cuser))
|
||||
@topic.user = cuser
|
||||
raise AccessError unless @topic.can_create? cuser
|
||||
|
||||
|
|
|
@ -53,7 +53,8 @@ class UsersController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
@user = User.new params[:user]
|
||||
@user = User.new(User.params(params, cuser))
|
||||
# FIXME: move to model
|
||||
@user.lastvisit = Date.today
|
||||
@user.lastip = request.env['REMOTE_ADDR']
|
||||
|
||||
|
@ -72,8 +73,9 @@ class UsersController < ApplicationController
|
|||
|
||||
def update
|
||||
raise AccessError unless @user.can_update? cuser
|
||||
# FIXME: use permit
|
||||
params[:user].delete(:username) unless @user.can_change_name? cuser
|
||||
if @user.update_attributes params[:user]
|
||||
if @user.update_attributes(User.params(params, cuser))
|
||||
flash[:notice] = t(:users_update)
|
||||
redirect_to_back
|
||||
else
|
||||
|
@ -127,10 +129,6 @@ class UsersController < ApplicationController
|
|||
|
||||
private
|
||||
|
||||
def user_params
|
||||
params.require(:user).permit(:raw_password, :firstname, :lastname, :email, :steamid, :country, :birthdate, :timezone, :public_email, :filter)
|
||||
end
|
||||
|
||||
def get_user
|
||||
@user = User.find(params[:id])
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class VotesController < ApplicationController
|
||||
def create
|
||||
@vote = Vote.new(params[:vote])
|
||||
@vote = Vote.new(Vote.params(params, cuser))
|
||||
@vote.user = cuser
|
||||
raise AccessError unless @vote.can_create? cuser
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ class WeeksController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
@week = Week.new(params[:week])
|
||||
@week = Week.new(Weeks.params(params, cuser))
|
||||
raise AccessError unless @week.can_create? cuser
|
||||
|
||||
if @week.save
|
||||
|
@ -26,7 +26,7 @@ class WeeksController < ApplicationController
|
|||
def update
|
||||
raise AccessError unless @week.can_update? cuser
|
||||
|
||||
if @week.update_attributes(params[:week])
|
||||
if @week.update_attributes(Week.params(params, cuser))
|
||||
flash[:notice] = t(:weeks_update)
|
||||
redirect_to @week.contest
|
||||
else
|
||||
|
|
|
@ -3,16 +3,23 @@
|
|||
# Table name: articles
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# title :string(255)
|
||||
# status :integer not null
|
||||
# category_id :integer
|
||||
# text :text(16777215)
|
||||
# user_id :integer
|
||||
# text_coding :integer default("0"), not null
|
||||
# text_parsed :text(16777215)
|
||||
# title :string(255)
|
||||
# version :integer
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# version :integer
|
||||
# text_parsed :text(16777215)
|
||||
# text_coding :integer default(0), not null
|
||||
# category_id :integer
|
||||
# user_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_articles_on_category_id (category_id)
|
||||
# index_articles_on_created_at (created_at)
|
||||
# index_articles_on_created_at_and_status (created_at,status)
|
||||
# index_articles_on_user_id (user_id)
|
||||
#
|
||||
|
||||
class Article < ActiveRecord::Base
|
||||
|
|
|
@ -3,17 +3,24 @@
|
|||
# Table name: bans
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# steamid :string(255)
|
||||
# user_id :integer
|
||||
# addr :string(255)
|
||||
# server_id :integer
|
||||
# ban_type :integer
|
||||
# expiry :datetime
|
||||
# ip :string(255)
|
||||
# reason :string(255)
|
||||
# steamid :string(255)
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# ban_type :integer
|
||||
# ip :string(255)
|
||||
# creator_id :integer
|
||||
# server_id :integer
|
||||
# user_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_bans_on_creator_id (creator_id)
|
||||
# index_bans_on_server_id (server_id)
|
||||
# index_bans_on_user_id (user_id)
|
||||
#
|
||||
|
||||
class Ban < ActiveRecord::Base
|
||||
include Extra
|
||||
|
@ -96,4 +103,8 @@ class Ban < ActiveRecord::Base
|
|||
def can_destroy? cuser
|
||||
cuser and (cuser.admin? or (self.creator == cuser and cuser.allowed_to_ban?))
|
||||
end
|
||||
|
||||
def self.params params, cuser
|
||||
params.require(:ban).permit(:steamid, :user_id, :addr, :server_id, :expiry, :reason, :ban_type, :ip)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,11 +3,15 @@
|
|||
# Table name: brackets
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# contest_id :integer
|
||||
# name :string(255)
|
||||
# slots :integer
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# name :string(255)
|
||||
# contest_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_brackets_on_contest_id (contest_id)
|
||||
#
|
||||
|
||||
class Bracket < ActiveRecord::Base
|
||||
|
@ -78,4 +82,8 @@ class Bracket < ActiveRecord::Base
|
|||
def can_destroy? cuser
|
||||
cuser and cuser.admin?
|
||||
end
|
||||
|
||||
def self.params params, cuser
|
||||
params.require(:bracket).permit(:contest_id, :slots, :name)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,13 +3,18 @@
|
|||
# Table name: bracketers
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# bracket_id :integer
|
||||
# column :integer
|
||||
# row :integer
|
||||
# match_id :integer
|
||||
# team_id :integer
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# bracket_id :integer
|
||||
# match_id :integer
|
||||
# team_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_bracketers_on_match_id (match_id)
|
||||
# index_bracketers_on_team_id (team_id)
|
||||
#
|
||||
|
||||
class Bracketer < ActiveRecord::Base
|
||||
|
|
|
@ -3,11 +3,16 @@
|
|||
# Table name: categories
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# domain :integer
|
||||
# name :string(255)
|
||||
# sort :integer
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# domain :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_categories_on_domain (domain)
|
||||
# index_categories_on_sort (sort)
|
||||
#
|
||||
|
||||
class Category < ActiveRecord::Base
|
||||
|
@ -79,4 +84,8 @@ class Category < ActiveRecord::Base
|
|||
def can_destroy? cuser
|
||||
cuser and cuser.admin?
|
||||
end
|
||||
|
||||
def self.params(params, cuser)
|
||||
params.require(:ban).permit(:name, :sort, :domain)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,20 +3,29 @@
|
|||
# Table name: challenges
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# contester1_id :integer
|
||||
# contester2_id :integer
|
||||
# match_time :datetime
|
||||
# default_time :datetime
|
||||
# mandatory :boolean
|
||||
# server_id :integer
|
||||
# user_id :integer
|
||||
# details :string(255)
|
||||
# mandatory :boolean
|
||||
# match_time :datetime
|
||||
# response :string(255)
|
||||
# status :integer default("0"), not null
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# contester1_id :integer
|
||||
# contester2_id :integer
|
||||
# map1_id :string(255)
|
||||
# map2_id :string(255)
|
||||
# status :integer default(0), not null
|
||||
# server_id :integer
|
||||
# user_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_challenges_on_contester1_id (contester1_id)
|
||||
# index_challenges_on_contester2_id (contester2_id)
|
||||
# index_challenges_on_map1_id (map1_id)
|
||||
# index_challenges_on_map2_id (map2_id)
|
||||
# index_challenges_on_server_id (server_id)
|
||||
# index_challenges_on_user_id (user_id)
|
||||
#
|
||||
|
||||
class Challenge < ActiveRecord::Base
|
||||
|
@ -256,4 +265,8 @@ class Challenge < ActiveRecord::Base
|
|||
def can_destroy? cuser
|
||||
cuser and (contester1.team.is_leader? cuser or cuser.admin?) and status == STATUS_PENDING# and autodefault.future?
|
||||
end
|
||||
|
||||
def self.params params, cuser
|
||||
params.require(:challenge).permit(:contester1_id, :contester2_id, :match_time, :mandatory, :server_id, :details, :response, :map1_id, :map2_id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,13 +3,20 @@
|
|||
# Table name: comments
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# text :text
|
||||
# user_id :integer
|
||||
# commentable_type :string(255)
|
||||
# commentable_id :integer
|
||||
# text :text(65535)
|
||||
# text_parsed :text(65535)
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# text_parsed :text
|
||||
# commentable_id :integer
|
||||
# user_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_comments_on_commentable_type (commentable_type)
|
||||
# index_comments_on_commentable_type_and_commentable_id (commentable_type,commentable_id)
|
||||
# index_comments_on_commentable_type_and_id (commentable_type,id)
|
||||
# index_comments_on_user_id (user_id)
|
||||
#
|
||||
|
||||
class Comment < ActiveRecord::Base
|
||||
|
@ -58,4 +65,8 @@ class Comment < ActiveRecord::Base
|
|||
def can_destroy? cuser
|
||||
cuser and cuser.admin?
|
||||
end
|
||||
|
||||
def self.params params, cuser
|
||||
params.require(:ban).permit(:text, :user_id, :commentable_type, :commentable_id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,23 +3,30 @@
|
|||
# Table name: contests
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# name :string(255)
|
||||
# start :datetime
|
||||
# contest_type :integer default("0"), not null
|
||||
# default_time :time
|
||||
# end :datetime
|
||||
# modulus_3to1 :float(24)
|
||||
# modulus_4to0 :float(24)
|
||||
# modulus_base :integer
|
||||
# modulus_even :float(24)
|
||||
# name :string(255)
|
||||
# short_name :string(255)
|
||||
# start :datetime
|
||||
# status :integer
|
||||
# weight :integer
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# default_time :time
|
||||
# contest_type :integer default(0), not null
|
||||
# winner_id :integer
|
||||
# demos_id :integer
|
||||
# short_name :string(255)
|
||||
# weight :integer
|
||||
# modulus_base :integer
|
||||
# modulus_even :float
|
||||
# modulus_3to1 :float
|
||||
# modulus_4to0 :float
|
||||
# rules_id :integer
|
||||
# winner_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_contests_on_demos_id (demos_id)
|
||||
# index_contests_on_rules_id (rules_id)
|
||||
# index_contests_on_status (status)
|
||||
# index_contests_on_winner_id (winner_id)
|
||||
#
|
||||
|
||||
class Contest < ActiveRecord::Base
|
||||
|
@ -139,4 +146,11 @@ class Contest < ActiveRecord::Base
|
|||
def can_destroy? cuser
|
||||
cuser and cuser.admin?
|
||||
end
|
||||
|
||||
def self.params params, cuser
|
||||
params.require(:contest).permit(:name, :start, :end, :status, :default_time,
|
||||
:contest_type, :winner_id, :demos_id, :short_name,
|
||||
:weight, :modulus_base, :modulus_even,
|
||||
:modulus_3to1, :modulus_4to0, :rules_id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,17 +3,22 @@
|
|||
# Table name: contesters
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# team_id :integer
|
||||
# active :boolean default("1"), not null
|
||||
# draw :integer default("0"), not null
|
||||
# extra :integer not null
|
||||
# loss :integer default("0"), not null
|
||||
# score :integer default("0"), not null
|
||||
# trend :integer not null
|
||||
# win :integer default("0"), not null
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# score :integer default(0), not null
|
||||
# win :integer default(0), not null
|
||||
# loss :integer default(0), not null
|
||||
# draw :integer default(0), not null
|
||||
# contest_id :integer
|
||||
# trend :integer not null
|
||||
# extra :integer not null
|
||||
# active :boolean default(TRUE), not null
|
||||
# team_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_contesters_on_contest_id (contest_id)
|
||||
# index_contesters_on_team_id (team_id)
|
||||
#
|
||||
|
||||
class Contester < ActiveRecord::Base
|
||||
|
@ -121,4 +126,8 @@ class Contester < ActiveRecord::Base
|
|||
def can_destroy? cuser
|
||||
cuser and team.is_leader? cuser or cuser.admin?
|
||||
end
|
||||
|
||||
def self.params params, cuser
|
||||
params.require(:contester).permit(:team_id, :score, :win, :lowss, :draw, :contest_id, :active, :extra)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,20 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: custom_urls
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# name :string(255)
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# article_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_custom_urls_on_article_id (article_id)
|
||||
# index_custom_urls_on_name (name)
|
||||
#
|
||||
|
||||
# FIXME: move this to a gem
|
||||
class CustomUrl < ActiveRecord::Base
|
||||
belongs_to :article
|
||||
# FIXME: attr_accessible :name
|
||||
|
@ -9,4 +26,8 @@ class CustomUrl < ActiveRecord::Base
|
|||
|
||||
validates :article_id,
|
||||
presence: true
|
||||
end
|
||||
|
||||
def self.params(params, cuser)
|
||||
params.require(:custom_url).permit(:name, :article_id)
|
||||
end
|
||||
end
|
|
@ -3,16 +3,22 @@
|
|||
# Table name: data_files
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# name :string(255)
|
||||
# description :string(255)
|
||||
# md5 :string(255)
|
||||
# name :string(255)
|
||||
# path :string(255)
|
||||
# size :integer not null
|
||||
# md5 :string(255)
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# article_id :integer
|
||||
# directory_id :integer
|
||||
# related_id :integer
|
||||
# article_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_data_files_on_article_id (article_id)
|
||||
# index_data_files_on_directory_id (directory_id)
|
||||
# index_data_files_on_related_id (related_id)
|
||||
#
|
||||
|
||||
require 'digest/md5'
|
||||
|
@ -150,4 +156,8 @@ class DataFile < ActiveRecord::Base
|
|||
def can_destroy? cuser
|
||||
cuser and cuser.admin? or (article and article.can_create? cuser)
|
||||
end
|
||||
|
||||
def self.params(params, cuser)
|
||||
params.require(:data_file).permit(:description, :name, :article_id, :related_id, :directory_id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,15 +1,20 @@
|
|||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: directories
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# name :string(255)
|
||||
# description :string(255)
|
||||
# hidden :boolean default("0"), not null
|
||||
# name :string(255)
|
||||
# path :string(255)
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# parent_id :integer
|
||||
# hidden :boolean default(FALSE), not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_directories_on_parent_id (parent_id)
|
||||
#
|
||||
|
||||
class Directory < ActiveRecord::Base
|
||||
|
@ -59,7 +64,7 @@ class Directory < ActiveRecord::Base
|
|||
def update_timestamp
|
||||
self.created_at = File.mtime(path) if File.exists?(path)
|
||||
end
|
||||
|
||||
|
||||
def remove_files
|
||||
files.each do |subdir|
|
||||
subdir.destroy
|
||||
|
@ -113,4 +118,8 @@ class Directory < ActiveRecord::Base
|
|||
def can_destroy? cuser
|
||||
cuser and cuser.admin?
|
||||
end
|
||||
|
||||
def self.params(params, cuser)
|
||||
params.require(:directory).permit(:description, :hidden, :name, :parent_id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,12 +3,16 @@
|
|||
# Table name: forums
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# title :string(255)
|
||||
# description :string(255)
|
||||
# category_id :integer
|
||||
# position :integer
|
||||
# title :string(255)
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# position :integer
|
||||
# category_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_forums_on_category_id (category_id)
|
||||
#
|
||||
|
||||
class Forum < ActiveRecord::Base
|
||||
|
@ -78,4 +82,7 @@ class Forum < ActiveRecord::Base
|
|||
id IN (SELECT q.id from (#{Forum.public_forums.to_sql}) q )")
|
||||
end
|
||||
|
||||
def self.params(params, cuser)
|
||||
params.require(:data_file).permit(:description, :position, :title, :category_id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,11 +3,16 @@
|
|||
# Table name: forumers
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# forum_id :integer
|
||||
# group_id :integer
|
||||
# access :integer
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# forum_id :integer
|
||||
# group_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_forumers_on_forum_id (forum_id)
|
||||
# index_forumers_on_group_id (group_id)
|
||||
#
|
||||
|
||||
class Forumer < ActiveRecord::Base
|
||||
|
@ -36,4 +41,8 @@ class Forumer < ActiveRecord::Base
|
|||
def accesses
|
||||
{ACCESS_READ => "Read", ACCESS_REPLY => "Reply", ACCESS_TOPIC => "Post a Topic"}
|
||||
end
|
||||
|
||||
def self.params(params, cuser)
|
||||
params.require(:forumer).permit(:access, :forum_id, :group_id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,19 +3,27 @@
|
|||
# Table name: gathers
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# lastpick1 :datetime
|
||||
# lastpick2 :datetime
|
||||
# status :integer
|
||||
# turn :integer
|
||||
# votes :integer default("0"), not null
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# captain1_id :integer
|
||||
# captain2_id :integer
|
||||
# category_id :integer
|
||||
# map1_id :integer
|
||||
# map2_id :integer
|
||||
# server_id :integer
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# turn :integer
|
||||
# lastpick1 :datetime
|
||||
# lastpick2 :datetime
|
||||
# votes :integer default(0), not null
|
||||
# category_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_gathers_on_captain1_id (captain1_id)
|
||||
# index_gathers_on_captain2_id (captain2_id)
|
||||
# index_gathers_on_map1_id (map1_id)
|
||||
# index_gathers_on_map2_id (map2_id)
|
||||
# index_gathers_on_server_id (server_id)
|
||||
#
|
||||
|
||||
class Gather < ActiveRecord::Base
|
||||
|
@ -192,4 +200,8 @@ class Gather < ActiveRecord::Base
|
|||
game.gathers.ordered.first
|
||||
end
|
||||
end
|
||||
|
||||
def self.params(params, cuser)
|
||||
params.require(:gather).permit(:status, :captain1_id, :captain2_id, :map1_id, :map2_id, :server_id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,9 +3,14 @@
|
|||
# Table name: gather_maps
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# votes :integer
|
||||
# gather_id :integer
|
||||
# map_id :integer
|
||||
# votes :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_gather_maps_on_gather_id (gather_id)
|
||||
# index_gather_maps_on_map_id (map_id)
|
||||
#
|
||||
|
||||
class GatherMap < ActiveRecord::Base
|
||||
|
|
|
@ -3,13 +3,19 @@
|
|||
# Table name: gatherers
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# user_id :integer
|
||||
# gather_id :integer
|
||||
# status :integer default("0"), not null
|
||||
# team :integer
|
||||
# votes :integer default("0"), not null
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# votes :integer default(0), not null
|
||||
# status :integer default(0), not null
|
||||
# gather_id :integer
|
||||
# user_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_gatherers_on_gather_id (gather_id)
|
||||
# index_gatherers_on_updated_at_and_gather_id (updated_at,gather_id)
|
||||
# index_gatherers_on_user_id (user_id)
|
||||
#
|
||||
|
||||
class Gatherer < ActiveRecord::Base
|
||||
|
@ -163,4 +169,8 @@ class Gatherer < ActiveRecord::Base
|
|||
def can_destroy? cuser
|
||||
cuser and ((user == cuser or cuser.admin? or cuser.gather_moderator?) and gather.status == Gather::STATE_RUNNING)
|
||||
end
|
||||
|
||||
def self.params(params, cuser)
|
||||
params.require(:gatherer).permit(:status, :user_id, :gather_id, :team, :votes)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,6 +8,10 @@
|
|||
# updated_at :datetime
|
||||
# founder_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_groups_on_founder_id (founder_id)
|
||||
#
|
||||
|
||||
class Group < ActiveRecord::Base
|
||||
include Extra
|
||||
|
@ -24,7 +28,6 @@ class Group < ActiveRecord::Base
|
|||
GATHER_MODERATORS = 14
|
||||
CONTRIBUTORS = 16
|
||||
|
||||
#attr_protected :id, :updated_at, :created_at, :founder_id
|
||||
validates_length_of :name, :maximum => 20
|
||||
|
||||
has_and_belongs_to_many :users
|
||||
|
@ -118,4 +121,8 @@ class Group < ActiveRecord::Base
|
|||
end
|
||||
contributors
|
||||
end
|
||||
|
||||
def self.params(params, cuser)
|
||||
params.require(:gather).permit(:task)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,11 +3,16 @@
|
|||
# Table name: groupers
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# group_id :integer
|
||||
# user_id :integer
|
||||
# task :string(255)
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# group_id :integer
|
||||
# user_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_groupers_on_group_id (group_id)
|
||||
# index_groupers_on_user_id (user_id)
|
||||
#
|
||||
|
||||
class Grouper < ActiveRecord::Base
|
||||
|
@ -44,4 +49,6 @@ class Grouper < ActiveRecord::Base
|
|||
def can_destroy? cuser
|
||||
cuser and cuser.admin?
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
|
@ -3,16 +3,22 @@
|
|||
# Table name: issues
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# title :string(255)
|
||||
# solution :text(65535)
|
||||
# status :integer
|
||||
# assigned_id :integer
|
||||
# category_id :integer
|
||||
# text :text
|
||||
# author_id :integer
|
||||
# text :text(65535)
|
||||
# text_parsed :text(65535)
|
||||
# title :string(255)
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# solution :text
|
||||
# text_parsed :text
|
||||
# assigned_id :integer
|
||||
# author_id :integer
|
||||
# category_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_issues_on_assigned_id (assigned_id)
|
||||
# index_issues_on_author_id (author_id)
|
||||
# index_issues_on_category_id (category_id)
|
||||
#
|
||||
|
||||
class Issue < ActiveRecord::Base
|
||||
|
@ -126,5 +132,8 @@ class Issue < ActiveRecord::Base
|
|||
allowed
|
||||
end
|
||||
|
||||
|
||||
def self.params(params, cuser)
|
||||
params.require(:issue).permit(:solution, :status, :text, :title,
|
||||
:assigned_id, :author_id, :category_id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,10 +3,14 @@
|
|||
# Table name: locks
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# lockable_id :integer
|
||||
# lockable_type :string(255)
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# lockable_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_locks_on_lockable_id_and_lockable_type (lockable_id,lockable_type)
|
||||
#
|
||||
|
||||
class Lock < ActiveRecord::Base
|
||||
|
@ -20,4 +24,8 @@ class Lock < ActiveRecord::Base
|
|||
def can_destroy? cuser
|
||||
cuser and cuser.admin?
|
||||
end
|
||||
|
||||
def self.params(params, cuser)
|
||||
params.require(:lock).permit(:lockable_type, :lockable_id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
# Table name: maps
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# name :string(255)
|
||||
# deleted :boolean default("0"), not null
|
||||
# download :string(255)
|
||||
# name :string(255)
|
||||
# picture :string(255)
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# deleted :boolean default(FALSE), not null
|
||||
# picture :string(255)
|
||||
# category_id :integer
|
||||
#
|
||||
|
||||
|
@ -50,4 +50,8 @@ class Map < ActiveRecord::Base
|
|||
def can_destroy? cuser
|
||||
cuser and cuser.admin?
|
||||
end
|
||||
|
||||
def self.params(params, cuser)
|
||||
params.require(:map).permit(:name, :download, :picture, :category_id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,29 +3,46 @@
|
|||
# Table name: matches
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# contester1_id :integer
|
||||
# contester2_id :integer
|
||||
# score1 :integer
|
||||
# score2 :integer
|
||||
# match_time :datetime
|
||||
# challenge_id :integer
|
||||
# contest_id :integer
|
||||
# report :text
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# map1_id :integer
|
||||
# map2_id :integer
|
||||
# server_id :integer
|
||||
# motm_id :integer
|
||||
# demo_id :integer
|
||||
# week_id :integer
|
||||
# referee_id :integer
|
||||
# forfeit :boolean
|
||||
# diff :integer
|
||||
# forfeit :boolean
|
||||
# match_time :datetime
|
||||
# points1 :integer
|
||||
# points2 :integer
|
||||
# hltv_id :integer
|
||||
# report :text(65535)
|
||||
# score1 :integer
|
||||
# score2 :integer
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# caster_id :string(255)
|
||||
# challenge_id :integer
|
||||
# contest_id :integer
|
||||
# contester1_id :integer
|
||||
# contester2_id :integer
|
||||
# demo_id :integer
|
||||
# hltv_id :integer
|
||||
# map1_id :integer
|
||||
# map2_id :integer
|
||||
# motm_id :integer
|
||||
# referee_id :integer
|
||||
# server_id :integer
|
||||
# week_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_matches_on_challenge_id (challenge_id)
|
||||
# index_matches_on_contest_id (contest_id)
|
||||
# index_matches_on_contester1_id (contester1_id)
|
||||
# index_matches_on_contester2_id (contester2_id)
|
||||
# index_matches_on_demo_id (demo_id)
|
||||
# index_matches_on_hltv_id (hltv_id)
|
||||
# index_matches_on_map1_id (map1_id)
|
||||
# index_matches_on_map2_id (map2_id)
|
||||
# index_matches_on_match_time (match_time)
|
||||
# index_matches_on_motm_id (motm_id)
|
||||
# index_matches_on_referee_id (referee_id)
|
||||
# index_matches_on_score1_and_score2 (score1,score2)
|
||||
# index_matches_on_server_id (server_id)
|
||||
# index_matches_on_week_id (week_id)
|
||||
#
|
||||
|
||||
class Match < ActiveRecord::Base
|
||||
|
@ -361,4 +378,9 @@ class Match < ActiveRecord::Base
|
|||
def user_in_match?(user)
|
||||
user && (user.team == contester1.team || user.team == contester2.team)
|
||||
end
|
||||
|
||||
def self.params(params, cuser)
|
||||
# FIXME: check this
|
||||
params.require(:match).permit(:diff, :forfeit, :match_time, :points1, :points2, :report, :score1, :score2, :caster_id, :challenge_id, :contest_id, :contester1_id, :contester2_id, :demo_id, :hltv_id, :map1_id, :map2_id, :motm_id, :referee_id, :server_Id, :week_id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,17 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: match_proposals
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# proposed_time :datetime
|
||||
# status :integer
|
||||
# match_id :integer
|
||||
# team_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_match_proposals_on_status (status)
|
||||
#
|
||||
class MatchProposal < ActiveRecord::Base
|
||||
|
||||
STATUS_PENDING = 0
|
||||
|
@ -84,4 +98,7 @@ class MatchProposal < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def self.params(params, cuser)
|
||||
params.require(:match_proposal).permit(:status, :match_id, :team_id, :proposed_time)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,12 +3,18 @@
|
|||
# Table name: matchers
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# match_id :integer not null
|
||||
# user_id :integer not null
|
||||
# contester_id :integer not null
|
||||
# merc :boolean not null
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# merc :boolean not null
|
||||
# contester_id :integer not null
|
||||
# match_id :integer not null
|
||||
# user_id :integer not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_matchers_on_contester_id (contester_id)
|
||||
# index_matchers_on_match_id (match_id)
|
||||
# index_matchers_on_user_id (user_id)
|
||||
#
|
||||
|
||||
class Matcher < ActiveRecord::Base
|
||||
|
|
|
@ -3,15 +3,20 @@
|
|||
# Table name: messages
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# sender_type :string(255)
|
||||
# sender_id :integer
|
||||
# recipient_type :string(255)
|
||||
# recipient_id :integer
|
||||
# sender_type :string(255)
|
||||
# text :text(65535)
|
||||
# text_parsed :text(65535)
|
||||
# title :string(255)
|
||||
# text :text
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# text_parsed :text
|
||||
# recipient_id :integer
|
||||
# sender_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_messages_on_recipient_id_and_recipient_type (recipient_id,recipient_type)
|
||||
# index_messages_on_sender_id_and_sender_type (sender_id,sender_type)
|
||||
#
|
||||
|
||||
class Message < ActiveRecord::Base
|
||||
|
@ -90,4 +95,9 @@ class Message < ActiveRecord::Base
|
|||
def can_create? cuser
|
||||
cuser and !cuser.banned?(Ban::TYPE_MUTE)
|
||||
end
|
||||
|
||||
def self.params(params, cuser)
|
||||
# FIXME: check this
|
||||
params.require(:message).permit(:recipient_type, :sender_type, :title, :text, :recipient_id, :sender_id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,19 +3,27 @@
|
|||
# Table name: movies
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# name :string(255)
|
||||
# content :string(255)
|
||||
# format :string(255)
|
||||
# user_id :integer
|
||||
# file_id :integer
|
||||
# length :integer
|
||||
# name :string(255)
|
||||
# picture :string(255)
|
||||
# status :integer
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# picture :string(255)
|
||||
# preview_id :integer
|
||||
# length :integer
|
||||
# match_id :integer
|
||||
# status :integer
|
||||
# category_id :integer
|
||||
# file_id :integer
|
||||
# match_id :integer
|
||||
# preview_id :integer
|
||||
# user_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_movies_on_file_id (file_id)
|
||||
# index_movies_on_match_id (match_id)
|
||||
# index_movies_on_preview_id (preview_id)
|
||||
# index_movies_on_status (status)
|
||||
# index_movies_on_user_id (user_id)
|
||||
#
|
||||
|
||||
# Rails.root.join('lib/plugins/acts_as_rateable/init.rb')
|
||||
|
@ -100,75 +108,79 @@ class Movie < ActiveRecord::Base
|
|||
# self.file.save!
|
||||
# make_stream
|
||||
#end
|
||||
end
|
||||
|
||||
def make_preview x, y
|
||||
result = file.full_path.gsub(/\.\w{3}$/, "") + "_preview.mp4"
|
||||
params = "-vcodec libx264 -vpre hq -b 1200k -bt 1200k -acodec libmp3lame -ab 128k -ac 2"
|
||||
cmd = "#{SCREEN} -d -m #{FFMPEG} -y -i \"#{file.full_path}\" #{params} \"#{result}\""
|
||||
system cmd
|
||||
cmd
|
||||
end
|
||||
|
||||
def make_snapshot secs
|
||||
image = File.join(Rails.root, "public", "images", MOVIES, id.to_s + ".png")
|
||||
params = "-ss #{secs} -vcodec png -vframes 1 -an -f rawvideo -s 160x120"
|
||||
Movie.update_all({:picture => "#{id}.png"}, {:id => id})
|
||||
cmd = "#{FFMPEG} -y -i \"#{file.full_path}\" #{params} \"#{image}\""
|
||||
system cmd
|
||||
cmd
|
||||
end
|
||||
|
||||
def make_stream
|
||||
ip = stream_ip.match(/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/)[0]
|
||||
port = stream_port.match(/[0-9]{1,5}/)[0]
|
||||
cmd = "#{SCREEN} -d -m #{VLC} http://#{ip}:#{port} --sout \"#duplicate{dst=std{access=file,mux=mp4,dst=#{file.full_path}},dst=std{access=http,mux=ts,dst=#{LOCAL}}}\" vlc://quit"
|
||||
system cmd
|
||||
update_attribute :status, $?.pid
|
||||
cmd
|
||||
end
|
||||
|
||||
def self.filter_or_all order, filter
|
||||
order = case order
|
||||
when "date" then "data_files.created_at DESC"
|
||||
when "author" then "users.username ASC"
|
||||
when "ratings" then "total_ratings DESC"
|
||||
else "total_ratings DESC"
|
||||
end
|
||||
|
||||
# FIXME: use new system
|
||||
#movies = []
|
||||
#if filter
|
||||
# Movie.index.order(order).each do |movie|
|
||||
# if movie.file and movie.file.average_rating_round >= filter.to_i
|
||||
# movies << movie
|
||||
# end
|
||||
# end
|
||||
# return movies
|
||||
#else
|
||||
return with_ratings.order(order)
|
||||
def make_preview x, y
|
||||
result = file.full_path.gsub(/\.\w{3}$/, "") + "_preview.mp4"
|
||||
params = "-vcodec libx264 -vpre hq -b 1200k -bt 1200k -acodec libmp3lame -ab 128k -ac 2"
|
||||
cmd = "#{SCREEN} -d -m #{FFMPEG} -y -i \"#{file.full_path}\" #{params} \"#{result}\""
|
||||
system cmd
|
||||
cmd
|
||||
end
|
||||
|
||||
def make_snapshot secs
|
||||
image = File.join(Rails.root, "public", "images", MOVIES, id.to_s + ".png")
|
||||
params = "-ss #{secs} -vcodec png -vframes 1 -an -f rawvideo -s 160x120"
|
||||
Movie.update_all({:picture => "#{id}.png"}, {:id => id})
|
||||
cmd = "#{FFMPEG} -y -i \"#{file.full_path}\" #{params} \"#{image}\""
|
||||
system cmd
|
||||
cmd
|
||||
end
|
||||
|
||||
def make_stream
|
||||
ip = stream_ip.match(/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/)[0]
|
||||
port = stream_port.match(/[0-9]{1,5}/)[0]
|
||||
cmd = "#{SCREEN} -d -m #{VLC} http://#{ip}:#{port} --sout \"#duplicate{dst=std{access=file,mux=mp4,dst=#{file.full_path}},dst=std{access=http,mux=ts,dst=#{LOCAL}}}\" vlc://quit"
|
||||
system cmd
|
||||
update_attribute :status, $?.pid
|
||||
cmd
|
||||
end
|
||||
|
||||
def self.filter_or_all order, filter
|
||||
order = case order
|
||||
when "date" then "data_files.created_at DESC"
|
||||
when "author" then "users.username ASC"
|
||||
when "ratings" then "total_ratings DESC"
|
||||
else "total_ratings DESC"
|
||||
end
|
||||
|
||||
# FIXME: use new system
|
||||
#movies = []
|
||||
#if filter
|
||||
# Movie.index.order(order).each do |movie|
|
||||
# if movie.file and movie.file.average_rating_round >= filter.to_i
|
||||
# movies << movie
|
||||
# end
|
||||
# end
|
||||
# return movies
|
||||
#else
|
||||
return with_ratings.order(order)
|
||||
#end
|
||||
end
|
||||
|
||||
#def update_status
|
||||
# if status and status > 0
|
||||
# begin
|
||||
# Process.getpgid(status) != -1
|
||||
# rescue Errno::ESRCH
|
||||
# update_attribute :status, 0
|
||||
# end
|
||||
# end
|
||||
#end
|
||||
end
|
||||
|
||||
#def update_status
|
||||
# if status and status > 0
|
||||
# begin
|
||||
# Process.getpgid(status) != -1
|
||||
# rescue Errno::ESRCH
|
||||
# update_attribute :status, 0
|
||||
# end
|
||||
# end
|
||||
#end
|
||||
def can_create? cuser
|
||||
cuser and cuser.admin? or cuser.groups.exists? :id => Group::MOVIES
|
||||
end
|
||||
|
||||
def can_create? cuser
|
||||
cuser and cuser.admin? or cuser.groups.exists? :id => Group::MOVIES
|
||||
end
|
||||
def can_update? cuser
|
||||
cuser and cuser.admin? or user == cuser
|
||||
end
|
||||
|
||||
def can_update? cuser
|
||||
cuser and cuser.admin? or user == cuser
|
||||
end
|
||||
def can_destroy? cuser
|
||||
cuser and cuser.admin?
|
||||
end
|
||||
|
||||
def can_destroy? cuser
|
||||
cuser and cuser.admin?
|
||||
end
|
||||
def self.params(params, cuser)
|
||||
params.require(:movie).permit(:content, :format, :length, :name, :picture, :status, :category_id, :file_id, :match_id, :preview_id, :user_id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,10 +4,14 @@
|
|||
#
|
||||
# id :integer not null, primary key
|
||||
# option :string(255)
|
||||
# poll_id :integer
|
||||
# votes :integer default("0"), not null
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# votes :integer default(0), not null
|
||||
# poll_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_options_on_poll_id (poll_id)
|
||||
#
|
||||
|
||||
class Option < ActiveRecord::Base
|
||||
|
@ -23,4 +27,9 @@ class Option < ActiveRecord::Base
|
|||
def to_s
|
||||
self.option
|
||||
end
|
||||
|
||||
def self.params(params, cuser)
|
||||
# FIXME: check this
|
||||
params.require(:option).permit(:option, :votes, :poll_id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,12 +3,16 @@
|
|||
# Table name: polls
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# question :string(255)
|
||||
# end_date :datetime
|
||||
# user_id :integer
|
||||
# question :string(255)
|
||||
# votes :integer default("0"), not null
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# votes :integer default(0), not null
|
||||
# user_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_polls_on_user_id (user_id)
|
||||
#
|
||||
|
||||
class Poll < ActiveRecord::Base
|
||||
|
@ -42,4 +46,8 @@ class Poll < ActiveRecord::Base
|
|||
def can_destroy? cuser
|
||||
cuser and cuser.admin?
|
||||
end
|
||||
|
||||
def self.params(params, cuser)
|
||||
params.require(:poll).permit(:end_date, :question)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,12 +3,17 @@
|
|||
# Table name: posts
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# text :text
|
||||
# topic_id :integer
|
||||
# user_id :integer
|
||||
# text :text(65535)
|
||||
# text_parsed :text(65535)
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# text_parsed :text
|
||||
# topic_id :integer
|
||||
# user_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_posts_on_topic_id (topic_id)
|
||||
# index_posts_on_user_id (user_id)
|
||||
#
|
||||
|
||||
class Post < ActiveRecord::Base
|
||||
|
@ -65,4 +70,9 @@ class Post < ActiveRecord::Base
|
|||
def can_destroy? cuser
|
||||
cuser and cuser.admin?
|
||||
end
|
||||
|
||||
def self.params(params, cuser)
|
||||
# FIXME: check this
|
||||
params.require(:post).permit(:text, :topic_id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,13 +3,18 @@
|
|||
# Table name: predictions
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# match_id :integer
|
||||
# user_id :integer
|
||||
# result :integer
|
||||
# score1 :integer
|
||||
# score2 :integer
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# result :integer
|
||||
# match_id :integer
|
||||
# user_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_predictions_on_match_id (match_id)
|
||||
# index_predictions_on_user_id (user_id)
|
||||
#
|
||||
|
||||
class Prediction < ActiveRecord::Base
|
||||
|
@ -30,4 +35,8 @@ class Prediction < ActiveRecord::Base
|
|||
def can_create? cuser
|
||||
cuser and match.match_time.future? and !match.score1 and !match.score2 and !cuser.predictions.exists?(:match_id => match.id)
|
||||
end
|
||||
|
||||
def self.params(params, cuser)
|
||||
params.require(:prediction).permit(:result, :score1, :score2, :match_id, :user_id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,57 +3,61 @@
|
|||
# Table name: profiles
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# user_id :integer
|
||||
# msn :string(255)
|
||||
# achievements :text(65535)
|
||||
# achievements_parsed :string(400)
|
||||
# avatar :string(255)
|
||||
# beverage :string(255)
|
||||
# book :string(255)
|
||||
# case :string(255)
|
||||
# clan_search :string(255)
|
||||
# cpu :string(255)
|
||||
# food :string(255)
|
||||
# gpu :string(255)
|
||||
# hdd :string(255)
|
||||
# head_phones :string(255)
|
||||
# hobby :string(255)
|
||||
# icq :string(255)
|
||||
# irc :string(255)
|
||||
# web :string(255)
|
||||
# town :string(255)
|
||||
# singleplayer :string(255)
|
||||
# multiplayer :string(255)
|
||||
# food :string(255)
|
||||
# beverage :string(255)
|
||||
# hobby :string(255)
|
||||
# music :string(255)
|
||||
# book :string(255)
|
||||
# movie :string(255)
|
||||
# tvseries :string(255)
|
||||
# res :string(255)
|
||||
# sensitivity :string(255)
|
||||
# monitor_hz :string(255)
|
||||
# scripts :string(255)
|
||||
# cpu :string(255)
|
||||
# gpu :string(255)
|
||||
# ram :string(255)
|
||||
# psu :string(255)
|
||||
# motherboard :string(255)
|
||||
# soundcard :string(255)
|
||||
# hdd :string(255)
|
||||
# case :string(255)
|
||||
# keyboard :string(255)
|
||||
# layout :string(255)
|
||||
# monitor :string(255)
|
||||
# monitor_hz :string(255)
|
||||
# motherboard :string(255)
|
||||
# mouse :string(255)
|
||||
# mouse_pad :string(255)
|
||||
# keyboard :string(255)
|
||||
# head_phones :string(255)
|
||||
# speakers :string(255)
|
||||
# achievements :text
|
||||
# updated_at :datetime
|
||||
# signature :string(255)
|
||||
# avatar :string(255)
|
||||
# clan_search :string(255)
|
||||
# notify_news :boolean
|
||||
# notify_articles :boolean
|
||||
# notify_movies :boolean
|
||||
# notify_gather :boolean
|
||||
# notify_own_match :boolean
|
||||
# movie :string(255)
|
||||
# msn :string(255)
|
||||
# multiplayer :string(255)
|
||||
# music :string(255)
|
||||
# notify_any_match :boolean
|
||||
# notify_pms :boolean default(TRUE), not null
|
||||
# notify_challenge :boolean default(TRUE), not null
|
||||
# notify_articles :boolean
|
||||
# notify_challenge :boolean default("1"), not null
|
||||
# notify_gather :boolean
|
||||
# notify_movies :boolean
|
||||
# notify_news :boolean
|
||||
# notify_own_match :boolean
|
||||
# notify_pms :boolean default("1"), not null
|
||||
# psu :string(255)
|
||||
# ram :string(255)
|
||||
# res :string(255)
|
||||
# scripts :string(255)
|
||||
# sensitivity :string(255)
|
||||
# signature :string(255)
|
||||
# signature_parsed :text(65535)
|
||||
# singleplayer :string(255)
|
||||
# soundcard :string(255)
|
||||
# speakers :string(255)
|
||||
# steam_profile :string(255)
|
||||
# achievements_parsed :string(255)
|
||||
# signature_parsed :string(255)
|
||||
# stream :string(255)
|
||||
# layout :string(255)
|
||||
# town :string(255)
|
||||
# tvseries :string(255)
|
||||
# web :string(255)
|
||||
# updated_at :datetime
|
||||
# user_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_profiles_on_user_id (user_id)
|
||||
#
|
||||
|
||||
class Profile < ActiveRecord::Base
|
||||
|
@ -97,4 +101,10 @@ class Profile < ActiveRecord::Base
|
|||
self.achievements_parsed = bbcode_to_html(achievements) if self.achievements
|
||||
self.signature_parsed = bbcode_to_html(signature) if self.signature
|
||||
end
|
||||
|
||||
def self.params(params, cuser)
|
||||
# FIXME: check this, add user_id
|
||||
# TEST
|
||||
params.require(:profile).except!(:id, :updated_at).permit!
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,31 +3,37 @@
|
|||
# Table name: servers
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# name :string(255)
|
||||
# active :boolean default("1"), not null
|
||||
# description :string(255)
|
||||
# dns :string(255)
|
||||
# domain :integer default("0"), not null
|
||||
# idle :datetime
|
||||
# ip :string(255)
|
||||
# port :string(255)
|
||||
# password :string(255)
|
||||
# irc :string(255)
|
||||
# user_id :integer
|
||||
# map :string(255)
|
||||
# max_players :integer
|
||||
# name :string(255)
|
||||
# official :boolean
|
||||
# password :string(255)
|
||||
# ping :string(255)
|
||||
# players :integer
|
||||
# port :string(255)
|
||||
# recordable_type :string(255)
|
||||
# recording :string(255)
|
||||
# reservation :string(255)
|
||||
# version :integer
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# map :string(255)
|
||||
# players :integer
|
||||
# max_players :integer
|
||||
# ping :string(255)
|
||||
# version :integer
|
||||
# domain :integer default(0), not null
|
||||
# reservation :string(255)
|
||||
# recording :string(255)
|
||||
# idle :datetime
|
||||
# default_id :integer
|
||||
# active :boolean default(TRUE), not null
|
||||
# recordable_type :string(255)
|
||||
# recordable_id :integer
|
||||
# category_id :integer
|
||||
# default_id :integer
|
||||
# recordable_id :integer
|
||||
# user_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_servers_on_default_id (default_id)
|
||||
# index_servers_on_players_and_domain (players,domain)
|
||||
# index_servers_on_user_id (user_id)
|
||||
#
|
||||
|
||||
require "yaml"
|
||||
|
@ -138,4 +144,10 @@ class Server < ActiveRecord::Base
|
|||
hltv.save!
|
||||
end
|
||||
end
|
||||
|
||||
def self.params(params, cuser)
|
||||
# FIXME: check this, add user_id
|
||||
# TEST
|
||||
params.require(:server).except!(:id, :created_at, :user_id, :map, :players, :maxplayers, :ping, :version, :updated_at).permit!
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,12 +3,17 @@
|
|||
# Table name: shoutmsgs
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# user_id :integer
|
||||
# shoutable_type :string(255)
|
||||
# text :string(255)
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# shoutable_type :string(255)
|
||||
# shoutable_id :integer
|
||||
# user_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_shoutmsgs_on_shoutable_type_and_shoutable_id (shoutable_type,shoutable_id)
|
||||
# index_shoutmsgs_on_user_id (user_id)
|
||||
#
|
||||
|
||||
class Shoutmsg < ActiveRecord::Base
|
||||
|
@ -49,4 +54,8 @@ class Shoutmsg < ActiveRecord::Base
|
|||
end
|
||||
return true
|
||||
end
|
||||
|
||||
def self.params(params, cuser)
|
||||
params.require(:shoutmsg).permit(:shoutable_id, :shoutable_type, :text)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,19 +2,24 @@
|
|||
#
|
||||
# Table name: teams
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# name :string(255)
|
||||
# irc :string(255)
|
||||
# web :string(255)
|
||||
# tag :string(255)
|
||||
# country :string(255)
|
||||
# comment :string(255)
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# logo :string(255)
|
||||
# founder_id :integer
|
||||
# active :boolean default(TRUE), not null
|
||||
# recruiting :string(255)
|
||||
# id :integer not null, primary key
|
||||
# active :boolean default("1"), not null
|
||||
# comment :string(255)
|
||||
# country :string(255)
|
||||
# irc :string(255)
|
||||
# logo :string(255)
|
||||
# name :string(255)
|
||||
# recruiting :string(255)
|
||||
# tag :string(255)
|
||||
# teamers_count :integer
|
||||
# web :string(255)
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# founder_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_teams_on_founder_id (founder_id)
|
||||
#
|
||||
|
||||
class Team < ActiveRecord::Base
|
||||
|
@ -126,4 +131,8 @@ class Team < ActiveRecord::Base
|
|||
def can_destroy? cuser
|
||||
cuser and cuser.admin?
|
||||
end
|
||||
|
||||
def self.params(params, cuser)
|
||||
params.require(:team).except(:id, :active, :founder_id, :created_at, :updated_at).permit!
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,12 +3,17 @@
|
|||
# Table name: teamers
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# team_id :integer not null
|
||||
# user_id :integer not null
|
||||
# comment :string(255)
|
||||
# rank :integer not null
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# team_id :integer not null
|
||||
# user_id :integer not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_teamers_on_team_id (team_id)
|
||||
# index_teamers_on_user_id (user_id)
|
||||
#
|
||||
|
||||
class Teamer < ActiveRecord::Base
|
||||
|
@ -92,4 +97,8 @@ class Teamer < ActiveRecord::Base
|
|||
def can_destroy? cuser
|
||||
cuser and (user == cuser or team.is_leader? cuser or cuser.admin?)
|
||||
end
|
||||
|
||||
def self.params(params, cuser)
|
||||
params.require(:teamer).permit(:comment, :rank, :team_id, :user_id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,12 +3,17 @@
|
|||
# Table name: topics
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# state :integer default("0"), not null
|
||||
# title :string(255)
|
||||
# user_id :integer
|
||||
# forum_id :integer
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# state :integer default(0), not null
|
||||
# forum_id :integer
|
||||
# user_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_topics_on_forum_id (forum_id)
|
||||
# index_topics_on_user_id (user_id)
|
||||
#
|
||||
|
||||
class Topic < ActiveRecord::Base
|
||||
|
@ -122,4 +127,8 @@ class Topic < ActiveRecord::Base
|
|||
def states
|
||||
{STATE_NORMAL => "Normal", STATE_STICKY => "Sticky"}
|
||||
end
|
||||
|
||||
def self.params(params, cuser)
|
||||
params.permit(:state, :title, :forum_id, :user_id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,22 +3,27 @@
|
|||
# Table name: users
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# username :string(255)
|
||||
# password :string(255)
|
||||
# firstname :string(255)
|
||||
# lastname :string(255)
|
||||
# birthdate :date
|
||||
# country :string(255)
|
||||
# email :string(255)
|
||||
# steamid :string(255)
|
||||
# team_id :integer
|
||||
# firstname :string(255)
|
||||
# lastip :string(255)
|
||||
# lastname :string(255)
|
||||
# lastvisit :datetime
|
||||
# password :string(255)
|
||||
# public_email :boolean default("0"), not null
|
||||
# steamid :string(255)
|
||||
# time_zone :string(255)
|
||||
# username :string(255)
|
||||
# version :integer
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# lastip :string(255)
|
||||
# country :string(255)
|
||||
# birthdate :date
|
||||
# time_zone :string(255)
|
||||
# version :integer
|
||||
# public_email :boolean default(FALSE), not null
|
||||
# team_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_users_on_lastvisit (lastvisit)
|
||||
# index_users_on_team_id (team_id)
|
||||
#
|
||||
|
||||
require 'digest/md5'
|
||||
|
@ -181,6 +186,10 @@ class User < ActiveRecord::Base
|
|||
a
|
||||
end
|
||||
|
||||
def idle
|
||||
"%d m" % [TimeDifference.between(DateTime.now, lastvisit).in_minutes.floor]
|
||||
end
|
||||
|
||||
def current_layout
|
||||
profile.layout || 'default'
|
||||
end
|
||||
|
@ -344,4 +353,8 @@ class User < ActiveRecord::Base
|
|||
def self.casters
|
||||
Group.find(Group::CASTERS).users.order(:username)
|
||||
end
|
||||
|
||||
def self.params(params, cuser)
|
||||
params.require(:user).permit(:raw_password, :firstname, :lastname, :email, :steamid, :country, :birthdate, :timezone, :public_email, :filter)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,11 +3,15 @@
|
|||
# Table name: view_counts
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# viewable_id :integer
|
||||
# viewable_type :string(255)
|
||||
# ip_address :string(255)
|
||||
# logged_in :boolean
|
||||
# viewable_type :string(255)
|
||||
# created_at :date
|
||||
# viewable_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_view_counts_on_viewable_type_and_viewable_id (viewable_type,viewable_id)
|
||||
#
|
||||
|
||||
class ViewCount < ActiveRecord::Base
|
||||
|
|
|
@ -3,10 +3,15 @@
|
|||
# Table name: votes
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# votable_type :string(255)
|
||||
# poll_id :integer
|
||||
# user_id :integer
|
||||
# votable_id :integer
|
||||
# poll_id :integer
|
||||
# votable_type :string(255)
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_votes_on_user_id (user_id)
|
||||
# index_votes_on_votable_id_and_votable_type (votable_id,votable_type)
|
||||
#
|
||||
|
||||
class Vote < ActiveRecord::Base
|
||||
|
@ -65,4 +70,8 @@ class Vote < ActiveRecord::Base
|
|||
|
||||
return true
|
||||
end
|
||||
|
||||
def self.params(params, cuser)
|
||||
params.require(:vote).permit(:votable_type, :votable_id, :poll_id, :user_id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,11 +5,17 @@
|
|||
# id :integer not null, primary key
|
||||
# name :string(255)
|
||||
# start_date :date
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# contest_id :integer
|
||||
# map1_id :integer
|
||||
# map2_id :integer
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_weeks_on_contest_id (contest_id)
|
||||
# index_weeks_on_map1_id (map1_id)
|
||||
# index_weeks_on_map2_id (map2_id)
|
||||
#
|
||||
|
||||
class Week < ActiveRecord::Base
|
||||
|
@ -42,4 +48,8 @@ class Week < ActiveRecord::Base
|
|||
def can_destroy? cuser
|
||||
cuser and cuser.admin?
|
||||
end
|
||||
|
||||
def self.params(params, cuser)
|
||||
params.require(:week).permit(:name, :start_date, :contest_id, :map1_id, :map2_id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
<li<% if gatherer.status > 0 %> class="away"<% end %>>
|
||||
<%= flag gatherer.user.country %>
|
||||
<%= namelink gatherer.user %>
|
||||
( <%= gatherer.user.idle %> )
|
||||
<% if cuser and gatherer.can_destroy?(cuser) %>
|
||||
<%= link_to gatherer, method: :delete, class: 'delete' do %>
|
||||
<%= icon 'times' %>
|
||||
|
|
59
lib/tasks/auto_annotate_models.rake
Normal file
59
lib/tasks/auto_annotate_models.rake
Normal file
|
@ -0,0 +1,59 @@
|
|||
# NOTE: only doing this in development as some production environments (Heroku)
|
||||
# NOTE: are sensitive to local FS writes, and besides -- it's just not proper
|
||||
# NOTE: to have a dev-mode tool do its thing in production.
|
||||
if Rails.env.development?
|
||||
require 'annotate'
|
||||
task :set_annotation_options do
|
||||
# You can override any of these by setting an environment variable of the
|
||||
# same name.
|
||||
Annotate.set_defaults(
|
||||
'active_admin' => 'false',
|
||||
'additional_file_patterns' => [],
|
||||
'routes' => 'false',
|
||||
'models' => 'true',
|
||||
'position_in_routes' => 'before',
|
||||
'position_in_class' => 'before',
|
||||
'position_in_test' => 'before',
|
||||
'position_in_fixture' => 'before',
|
||||
'position_in_factory' => 'before',
|
||||
'position_in_serializer' => 'before',
|
||||
'show_foreign_keys' => 'true',
|
||||
'show_complete_foreign_keys' => 'false',
|
||||
'show_indexes' => 'true',
|
||||
'simple_indexes' => 'false',
|
||||
'model_dir' => 'app/models',
|
||||
'root_dir' => '',
|
||||
'include_version' => 'false',
|
||||
'require' => '',
|
||||
'exclude_tests' => 'false',
|
||||
'exclude_fixtures' => 'false',
|
||||
'exclude_factories' => 'false',
|
||||
'exclude_serializers' => 'false',
|
||||
'exclude_scaffolds' => 'true',
|
||||
'exclude_controllers' => 'true',
|
||||
'exclude_helpers' => 'true',
|
||||
'exclude_sti_subclasses' => 'false',
|
||||
'ignore_model_sub_dir' => 'false',
|
||||
'ignore_columns' => nil,
|
||||
'ignore_routes' => nil,
|
||||
'ignore_unknown_models' => 'false',
|
||||
'hide_limit_column_types' => 'integer,bigint,boolean',
|
||||
'hide_default_column_types' => 'json,jsonb,hstore',
|
||||
'skip_on_db_migrate' => 'false',
|
||||
'format_bare' => 'true',
|
||||
'format_rdoc' => 'false',
|
||||
'format_yard' => 'false',
|
||||
'format_markdown' => 'false',
|
||||
'sort' => 'false',
|
||||
'force' => 'false',
|
||||
'frozen' => 'false',
|
||||
'classified_sort' => 'true',
|
||||
'trace' => 'false',
|
||||
'wrapper_open' => nil,
|
||||
'wrapper_close' => nil,
|
||||
'with_comment' => 'true'
|
||||
)
|
||||
end
|
||||
|
||||
Annotate.load_tasks
|
||||
end
|
|
@ -3,16 +3,23 @@
|
|||
# Table name: bans
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# steamid :string(255)
|
||||
# user_id :integer
|
||||
# addr :string(255)
|
||||
# server_id :integer
|
||||
# ban_type :integer
|
||||
# expiry :datetime
|
||||
# ip :string(255)
|
||||
# reason :string(255)
|
||||
# steamid :string(255)
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# ban_type :integer
|
||||
# ip :string(255)
|
||||
# creator_id :integer
|
||||
# server_id :integer
|
||||
# user_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_bans_on_creator_id (creator_id)
|
||||
# index_bans_on_server_id (server_id)
|
||||
# index_bans_on_user_id (user_id)
|
||||
#
|
||||
|
||||
require "rails_helper"
|
||||
|
|
|
@ -3,12 +3,16 @@
|
|||
# Table name: forums
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# title :string(255)
|
||||
# description :string(255)
|
||||
# category_id :integer
|
||||
# position :integer
|
||||
# title :string(255)
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# position :integer
|
||||
# category_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_forums_on_category_id (category_id)
|
||||
#
|
||||
|
||||
require "rails_helper"
|
||||
|
|
|
@ -3,11 +3,16 @@
|
|||
# Table name: forumers
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# forum_id :integer
|
||||
# group_id :integer
|
||||
# access :integer
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# forum_id :integer
|
||||
# group_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_forumers_on_forum_id (forum_id)
|
||||
# index_forumers_on_group_id (group_id)
|
||||
#
|
||||
|
||||
require "rails_helper"
|
||||
|
|
|
@ -3,16 +3,22 @@
|
|||
# Table name: issues
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# title :string(255)
|
||||
# solution :text(65535)
|
||||
# status :integer
|
||||
# assigned_id :integer
|
||||
# category_id :integer
|
||||
# text :text
|
||||
# author_id :integer
|
||||
# text :text(65535)
|
||||
# text_parsed :text(65535)
|
||||
# title :string(255)
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# solution :text
|
||||
# text_parsed :text
|
||||
# assigned_id :integer
|
||||
# author_id :integer
|
||||
# category_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_issues_on_assigned_id (assigned_id)
|
||||
# index_issues_on_author_id (author_id)
|
||||
# index_issues_on_category_id (category_id)
|
||||
#
|
||||
|
||||
require "rails_helper"
|
||||
|
|
|
@ -3,15 +3,20 @@
|
|||
# Table name: messages
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# sender_type :string(255)
|
||||
# sender_id :integer
|
||||
# recipient_type :string(255)
|
||||
# recipient_id :integer
|
||||
# sender_type :string(255)
|
||||
# text :text(65535)
|
||||
# text_parsed :text(65535)
|
||||
# title :string(255)
|
||||
# text :text
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# text_parsed :text
|
||||
# recipient_id :integer
|
||||
# sender_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_messages_on_recipient_id_and_recipient_type (recipient_id,recipient_type)
|
||||
# index_messages_on_sender_id_and_sender_type (sender_id,sender_type)
|
||||
#
|
||||
|
||||
require "rails_helper"
|
||||
|
|
|
@ -3,12 +3,17 @@
|
|||
# Table name: posts
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# text :text
|
||||
# topic_id :integer
|
||||
# user_id :integer
|
||||
# text :text(65535)
|
||||
# text_parsed :text(65535)
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# text_parsed :text
|
||||
# topic_id :integer
|
||||
# user_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_posts_on_topic_id (topic_id)
|
||||
# index_posts_on_user_id (user_id)
|
||||
#
|
||||
|
||||
require "rails_helper"
|
||||
|
|
|
@ -3,31 +3,37 @@
|
|||
# Table name: servers
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# name :string(255)
|
||||
# active :boolean default("1"), not null
|
||||
# description :string(255)
|
||||
# dns :string(255)
|
||||
# domain :integer default("0"), not null
|
||||
# idle :datetime
|
||||
# ip :string(255)
|
||||
# port :string(255)
|
||||
# password :string(255)
|
||||
# irc :string(255)
|
||||
# user_id :integer
|
||||
# map :string(255)
|
||||
# max_players :integer
|
||||
# name :string(255)
|
||||
# official :boolean
|
||||
# password :string(255)
|
||||
# ping :string(255)
|
||||
# players :integer
|
||||
# port :string(255)
|
||||
# recordable_type :string(255)
|
||||
# recording :string(255)
|
||||
# reservation :string(255)
|
||||
# version :integer
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# map :string(255)
|
||||
# players :integer
|
||||
# max_players :integer
|
||||
# ping :string(255)
|
||||
# version :integer
|
||||
# domain :integer default(0), not null
|
||||
# reservation :string(255)
|
||||
# recording :string(255)
|
||||
# idle :datetime
|
||||
# default_id :integer
|
||||
# active :boolean default(TRUE), not null
|
||||
# recordable_type :string(255)
|
||||
# recordable_id :integer
|
||||
# category_id :integer
|
||||
# default_id :integer
|
||||
# recordable_id :integer
|
||||
# user_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_servers_on_default_id (default_id)
|
||||
# index_servers_on_players_and_domain (players,domain)
|
||||
# index_servers_on_user_id (user_id)
|
||||
#
|
||||
|
||||
require "rails_helper"
|
||||
|
|
|
@ -3,12 +3,17 @@
|
|||
# Table name: topics
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# state :integer default("0"), not null
|
||||
# title :string(255)
|
||||
# user_id :integer
|
||||
# forum_id :integer
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# state :integer default(0), not null
|
||||
# forum_id :integer
|
||||
# user_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_topics_on_forum_id (forum_id)
|
||||
# index_topics_on_user_id (user_id)
|
||||
#
|
||||
|
||||
require "spec_helper"
|
||||
|
|
|
@ -3,23 +3,27 @@
|
|||
# Table name: users
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# username :string(255)
|
||||
# password :string(255)
|
||||
# firstname :string(255)
|
||||
# lastname :string(255)
|
||||
# birthdate :date
|
||||
# country :string(255)
|
||||
# email :string(255)
|
||||
# steamid :string(255)
|
||||
# team_id :integer
|
||||
# firstname :string(255)
|
||||
# lastip :string(255)
|
||||
# lastname :string(255)
|
||||
# lastvisit :datetime
|
||||
# password :string(255)
|
||||
# public_email :boolean default("0"), not null
|
||||
# steamid :string(255)
|
||||
# time_zone :string(255)
|
||||
# username :string(255)
|
||||
# version :integer
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# lastip :string(255)
|
||||
# country :string(255)
|
||||
# birthdate :date
|
||||
# time_zone :string(255)
|
||||
# version :integer
|
||||
# public_email :boolean default(FALSE), not null
|
||||
# salt :string(255)
|
||||
# team_id :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_users_on_lastvisit (lastvisit)
|
||||
# index_users_on_team_id (team_id)
|
||||
#
|
||||
|
||||
require 'rails_helper'
|
||||
|
|
Loading…
Reference in a new issue