mirror of
https://github.com/ENSL/ensl.org.git
synced 2024-12-27 04:51:14 +00:00
Change before_filter and remove attr_protected
This commit is contained in:
parent
cca3a03f59
commit
fa4fbb589d
64 changed files with 76 additions and 69 deletions
|
@ -4,8 +4,8 @@ class ApplicationController < ActionController::Base
|
||||||
helper :all
|
helper :all
|
||||||
helper_method :cuser, :strip, :return_here
|
helper_method :cuser, :strip, :return_here
|
||||||
|
|
||||||
before_filter :update_user
|
before_action :update_user
|
||||||
before_filter :set_controller_and_action_names
|
before_action :set_controller_and_action_names
|
||||||
|
|
||||||
protect_from_forgery
|
protect_from_forgery
|
||||||
respond_to :html, :js
|
respond_to :html, :js
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class ArticlesController < ApplicationController
|
class ArticlesController < ApplicationController
|
||||||
before_filter :get_article, only: [:show, :edit, :update, :cleanup, :destroy]
|
before_action :get_article, only: [:show, :edit, :update, :cleanup, :destroy]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@categories = Category.ordered.nospecial.domain Category::DOMAIN_ARTICLES
|
@categories = Category.ordered.nospecial.domain Category::DOMAIN_ARTICLES
|
||||||
|
@ -39,7 +39,8 @@ class ArticlesController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@article = Article.new params[:article]
|
@article = Article.new article_params
|
||||||
|
([:article])
|
||||||
@article.user = cuser
|
@article.user = cuser
|
||||||
raise AccessError unless @article.can_create? cuser
|
raise AccessError unless @article.can_create? cuser
|
||||||
|
|
||||||
|
@ -53,7 +54,7 @@ class ArticlesController < ApplicationController
|
||||||
|
|
||||||
def update
|
def update
|
||||||
raise AccessError unless @article.can_update? cuser, params[:article]
|
raise AccessError unless @article.can_update? cuser, params[:article]
|
||||||
if @article.update_attributes(params[:article])
|
if @article.update_attributes(article_params)
|
||||||
flash[:notice] = t(:articles_update)
|
flash[:notice] = t(:articles_update)
|
||||||
redirect_to @article
|
redirect_to @article
|
||||||
else
|
else
|
||||||
|
@ -79,4 +80,8 @@ class ArticlesController < ApplicationController
|
||||||
def get_article
|
def get_article
|
||||||
@article = Article.find params[:id]
|
@article = Article.find params[:id]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def article_params
|
||||||
|
params.require(:article).permit(:tite, :status, :category_id, :text, :user_id)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class BansController < ApplicationController
|
class BansController < ApplicationController
|
||||||
before_filter :get_ban, only: [:show, :edit, :update, :destroy]
|
before_action :get_ban, only: [:show, :edit, :update, :destroy]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@bans = Ban.ordered
|
@bans = Ban.ordered
|
||||||
|
@ -32,7 +32,7 @@ class BansController < ApplicationController
|
||||||
|
|
||||||
def update
|
def update
|
||||||
raise AccessError unless @ban.can_update? cuser
|
raise AccessError unless @ban.can_update? cuser
|
||||||
if @ban.update_attributes(params[:ban])
|
if @ban.update_attributes(ban_params(ban_params))
|
||||||
flash[:notice] = t(:bans_update)
|
flash[:notice] = t(:bans_update)
|
||||||
redirect_to(@ban)
|
redirect_to(@ban)
|
||||||
else
|
else
|
||||||
|
@ -51,4 +51,8 @@ class BansController < ApplicationController
|
||||||
def get_ban
|
def get_ban
|
||||||
@ban = Ban.find(params[:id])
|
@ban = Ban.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def ban_params
|
||||||
|
params.permit(:steamid, :user_id, :addr, :server_id, :expiry, :reason, :ban_type, :ip)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class BracketsController < ApplicationController
|
class BracketsController < ApplicationController
|
||||||
before_filter :get_bracket, only: [:show, :edit, :update, :destroy]
|
before_action :get_bracket, only: [:show, :edit, :update, :destroy]
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
raise AccessError unless @bracket.can_update? cuser
|
raise AccessError unless @bracket.can_update? cuser
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class CategoriesController < ApplicationController
|
class CategoriesController < ApplicationController
|
||||||
before_filter :get_category, except: [:index, :new, :create]
|
before_action :get_category, except: [:index, :new, :create]
|
||||||
|
|
||||||
def show
|
def show
|
||||||
if [Category::DOMAIN_ARTICLES, Category::DOMAIN_NEWS].include? @category.domain
|
if [Category::DOMAIN_ARTICLES, Category::DOMAIN_NEWS].include? @category.domain
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class ChallengesController < ApplicationController
|
class ChallengesController < ApplicationController
|
||||||
before_filter :get_challenge, only: [:show, :edit, :update, :destroy]
|
before_action :get_challenge, only: [:show, :edit, :update, :destroy]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@challenges = Challenge.all
|
@challenges = Challenge.all
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class CommentsController < ApplicationController
|
class CommentsController < ApplicationController
|
||||||
before_filter :get_comment, only: [:raw, :quote, :edit, :update, :destroy]
|
before_action :get_comment, only: [:raw, :quote, :edit, :update, :destroy]
|
||||||
respond_to :html, :js
|
respond_to :html, :js
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class ContestersController < ApplicationController
|
class ContestersController < ApplicationController
|
||||||
before_filter :get_contester, only: [:show, :edit, :update, :recover, :destroy, :recalc]
|
before_action :get_contester, only: [:show, :edit, :update, :recover, :destroy, :recalc]
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@matches = Match.future.unfinished.ordered.of_contester @contester
|
@matches = Match.future.unfinished.ordered.of_contester @contester
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class ContestsController < ApplicationController
|
class ContestsController < ApplicationController
|
||||||
before_filter :get_contest, only: [:show, :edit, :update, :destroy, :del_map, :scores, :recalc, :confirmed_matches]
|
before_action :get_contest, only: [:show, :edit, :update, :destroy, :del_map, :scores, :recalc, :confirmed_matches]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
# @contests = Contest.all
|
# @contests = Contest.all
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class DataFilesController < ApplicationController
|
class DataFilesController < ApplicationController
|
||||||
before_filter :get_file, only: [:show, :edit, :update, :destroy, :rate, :addFile, :delFile]
|
before_action :get_file, only: [:show, :edit, :update, :destroy, :rate, :addFile, :delFile]
|
||||||
|
|
||||||
def show
|
def show
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class DirectoriesController < ApplicationController
|
class DirectoriesController < ApplicationController
|
||||||
before_filter :get_directory, except: [:new, :create]
|
before_action :get_directory, except: [:new, :create]
|
||||||
|
|
||||||
def show
|
def show
|
||||||
if @directory.hidden
|
if @directory.hidden
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class ForumsController < ApplicationController
|
class ForumsController < ApplicationController
|
||||||
before_filter :get_forum, only: [:show, :edit, :update, :up, :down, :destroy]
|
before_action :get_forum, only: [:show, :edit, :update, :up, :down, :destroy]
|
||||||
layout 'forums'
|
layout 'forums'
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class GatherersController < ApplicationController
|
class GatherersController < ApplicationController
|
||||||
before_filter :get_gatherer, except: [:create]
|
before_action :get_gatherer, except: [:create]
|
||||||
|
|
||||||
def create
|
def create
|
||||||
Gather.transaction do
|
Gather.transaction do
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class GathersController < ApplicationController
|
class GathersController < ApplicationController
|
||||||
before_filter :get_gather, except: [:latest, :index, :create]
|
before_action :get_gather, except: [:latest, :index, :create]
|
||||||
respond_to :html, :js
|
respond_to :html, :js
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class GroupsController < ApplicationController
|
class GroupsController < ApplicationController
|
||||||
before_filter :get_group, except: [:index, :new, :create]
|
before_action :get_group, except: [:index, :new, :create]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@groups = Group.all
|
@groups = Group.all
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class IssuesController < ApplicationController
|
class IssuesController < ApplicationController
|
||||||
before_filter :get_issue, only: [:show, :edit, :update, :destroy]
|
before_action :get_issue, only: [:show, :edit, :update, :destroy]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
raise AccessError unless cuser and (cuser.admin? or cuser.moderator?)
|
raise AccessError unless cuser and (cuser.admin? or cuser.moderator?)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class MapsController < ApplicationController
|
class MapsController < ApplicationController
|
||||||
before_filter :get_map, only: [:show, :edit, :update, :destroy]
|
before_action :get_map, only: [:show, :edit, :update, :destroy]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@maps = Map.basic
|
@maps = Map.basic
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class MatchProposalsController < ApplicationController
|
class MatchProposalsController < ApplicationController
|
||||||
before_filter :get_match
|
before_action :get_match
|
||||||
def index
|
def index
|
||||||
raise AccessError unless cuser.admin? || @match.user_in_match?(cuser)
|
raise AccessError unless cuser.admin? || @match.user_in_match?(cuser)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class MatchesController < ApplicationController
|
class MatchesController < ApplicationController
|
||||||
before_filter :get_match, except: [:index, :new, :create, :admin]
|
before_action :get_match, except: [:index, :new, :create, :admin]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@matches = Match.active
|
@matches = Match.active
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class MessagesController < ApplicationController
|
class MessagesController < ApplicationController
|
||||||
before_filter :get_message, only: [:show, :edit, :update, :destroy]
|
before_action :get_message, only: [:show, :edit, :update, :destroy]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
raise AccessError unless cuser
|
raise AccessError unless cuser
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class MoviesController < ApplicationController
|
class MoviesController < ApplicationController
|
||||||
before_filter :get_movie, except: [:index, :new, :create]
|
before_action :get_movie, except: [:index, :new, :create]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@movies = Movie.filter_or_all(params[:filter], params[:order])
|
@movies = Movie.filter_or_all(params[:filter], params[:order])
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class PollsController < ApplicationController
|
class PollsController < ApplicationController
|
||||||
before_filter :get_poll, except: [:index, :new, :create]
|
before_action :get_poll, except: [:index, :new, :create]
|
||||||
respond_to :js
|
respond_to :js
|
||||||
|
|
||||||
def add
|
def add
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class PollsController < ApplicationController
|
class PollsController < ApplicationController
|
||||||
before_filter :get_poll, except: [:index, :new, :create]
|
before_action :get_poll, except: [:index, :new, :create]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@polls = Poll.all
|
@polls = Poll.all
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class PostsController < ApplicationController
|
class PostsController < ApplicationController
|
||||||
before_filter :get_post, except: [:new, :create]
|
before_action :get_post, except: [:new, :create]
|
||||||
respond_to :html, :js
|
respond_to :html, :js
|
||||||
layout 'forums'
|
layout 'forums'
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class ServersController < ApplicationController
|
class ServersController < ApplicationController
|
||||||
before_filter :get_server, except: [:index, :refresh, :new, :create]
|
before_action :get_server, except: [:index, :refresh, :new, :create]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@servers = Server.hlds.active.ordered.all :include => :user
|
@servers = Server.hlds.active.ordered.all :include => :user
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class TeamsController < ApplicationController
|
class TeamsController < ApplicationController
|
||||||
before_filter :get_team, only: [:show, :edit, :update, :destroy, :recover]
|
before_action :get_team, only: [:show, :edit, :update, :destroy, :recover]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@teams = Team.search(params[:search]).paginate(per_page: 80, page: params[:page]).ordered
|
@teams = Team.search(params[:search]).paginate(per_page: 80, page: params[:page]).ordered
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class TopicsController < ApplicationController
|
class TopicsController < ApplicationController
|
||||||
before_filter :get_topic, only: [:show, :reply, :edit, :update, :destroy]
|
before_action :get_topic, only: [:show, :reply, :edit, :update, :destroy]
|
||||||
layout 'forums'
|
layout 'forums'
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class UsersController < ApplicationController
|
class UsersController < ApplicationController
|
||||||
before_filter :get_user, only: [:show, :history, :popup, :agenda, :edit, :update, :destroy]
|
before_action :get_user, only: [:show, :history, :popup, :agenda, :edit, :update, :destroy]
|
||||||
respond_to :html, :js
|
respond_to :html, :js
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class VersionsController < ApplicationController
|
class VersionsController < ApplicationController
|
||||||
before_filter :get_article
|
before_action :get_article
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@versions = @article.versions
|
@versions = @article.versions
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class WeeksController < ApplicationController
|
class WeeksController < ApplicationController
|
||||||
before_filter :get_week, except: [:new, :create]
|
before_action :get_week, except: [:new, :create]
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@week = Week.new
|
@week = Week.new
|
||||||
|
|
|
@ -34,8 +34,6 @@ class Article < ActiveRecord::Base
|
||||||
G_RULES = 464
|
G_RULES = 464
|
||||||
COMPMOD = 998
|
COMPMOD = 998
|
||||||
|
|
||||||
attr_protected :id, :updated_at, :created_at, :user_id, :version
|
|
||||||
|
|
||||||
scope :recent, -> { order('created_at DESC').limit(8) }
|
scope :recent, -> { order('created_at DESC').limit(8) }
|
||||||
scope :with_comments, -> {
|
scope :with_comments, -> {
|
||||||
select("articles.*, COUNT(C.id) AS comment_num").
|
select("articles.*, COUNT(C.id) AS comment_num").
|
||||||
|
|
|
@ -26,7 +26,7 @@ class Ban < ActiveRecord::Base
|
||||||
TYPE_GATHER = 5
|
TYPE_GATHER = 5
|
||||||
VENT_BANS = "tmp/bans.txt"
|
VENT_BANS = "tmp/bans.txt"
|
||||||
|
|
||||||
attr_protected :id, :created_at, :updated_at
|
#attr_protected :id, :created_at, :updated_at
|
||||||
attr_accessor :len, :user_name
|
attr_accessor :len, :user_name
|
||||||
|
|
||||||
scope :ordered, -> {order("created_at DESC")}
|
scope :ordered, -> {order("created_at DESC")}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
class Bracket < ActiveRecord::Base
|
class Bracket < ActiveRecord::Base
|
||||||
include Extra
|
include Extra
|
||||||
|
|
||||||
attr_protected :id, :created_at, :updated_at
|
#attr_protected :id, :created_at, :updated_at
|
||||||
|
|
||||||
belongs_to :contest
|
belongs_to :contest
|
||||||
has_many :bracketers
|
has_many :bracketers
|
||||||
|
|
|
@ -16,7 +16,7 @@ class Bracketer < ActiveRecord::Base
|
||||||
include Exceptions
|
include Exceptions
|
||||||
include Extra
|
include Extra
|
||||||
|
|
||||||
attr_protected :id, :updated_at, :created_at
|
#attr_protected :id, :updated_at, :created_at
|
||||||
|
|
||||||
belongs_to :contest
|
belongs_to :contest
|
||||||
belongs_to :match
|
belongs_to :match
|
||||||
|
|
|
@ -28,7 +28,7 @@ class Category < ActiveRecord::Base
|
||||||
|
|
||||||
PER_PAGE = 3
|
PER_PAGE = 3
|
||||||
|
|
||||||
attr_protected :id, :updated_at, :created_at, :sort
|
#attr_protected :id, :updated_at, :created_at, :sort
|
||||||
|
|
||||||
validates_length_of :name, :in => 1..30
|
validates_length_of :name, :in => 1..30
|
||||||
validate :validate_domain
|
validate :validate_domain
|
||||||
|
|
|
@ -34,7 +34,7 @@ class Challenge < ActiveRecord::Base
|
||||||
ACCEPT_BEFORE_VOLUNTARY = 300 # Time to accept before voluntary match time: 5 mins
|
ACCEPT_BEFORE_VOLUNTARY = 300 # Time to accept before voluntary match time: 5 mins
|
||||||
MATCH_LENGTH = 7200 # Usual match length (for servers): 2 hours
|
MATCH_LENGTH = 7200 # Usual match length (for servers): 2 hours
|
||||||
|
|
||||||
attr_protected :id, :updated_at, :created_at, :default_time, :user_id, :status
|
#attr_protected :id, :updated_at, :created_at, :default_time, :user_id, :status
|
||||||
|
|
||||||
validates_presence_of :contester1, :contester2
|
validates_presence_of :contester1, :contester2
|
||||||
validates_presence_of :map2, :on => :update
|
validates_presence_of :map2, :on => :update
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
class Comment < ActiveRecord::Base
|
class Comment < ActiveRecord::Base
|
||||||
include Extra
|
include Extra
|
||||||
|
|
||||||
attr_protected :id, :updated_at, :created_at, :user_id
|
#attr_protected :id, :updated_at, :created_at, :user_id
|
||||||
|
|
||||||
scope :with_userteam, -> { includes({:user => :team}) }
|
scope :with_userteam, -> { includes({:user => :team}) }
|
||||||
scope :recent, -> (n) { order("id DESC").limit(n) }
|
scope :recent, -> (n) { order("id DESC").limit(n) }
|
||||||
|
|
|
@ -33,7 +33,7 @@ class Contest < ActiveRecord::Base
|
||||||
TYPE_LEAGUE = 1
|
TYPE_LEAGUE = 1
|
||||||
TYPE_BRACKET = 2
|
TYPE_BRACKET = 2
|
||||||
|
|
||||||
attr_protected :id, :updated_at, :created_at
|
#attr_protected :id, :updated_at, :created_at
|
||||||
|
|
||||||
scope :active, -> { where.not(status: STATUS_CLOSED) }
|
scope :active, -> { where.not(status: STATUS_CLOSED) }
|
||||||
scope :inactive, -> { where(status: STATUS_CLOSED) }
|
scope :inactive, -> { where(status: STATUS_CLOSED) }
|
||||||
|
|
|
@ -23,7 +23,7 @@ class Contester < ActiveRecord::Base
|
||||||
TREND_UP = 1
|
TREND_UP = 1
|
||||||
TREND_DOWN = 2
|
TREND_DOWN = 2
|
||||||
|
|
||||||
attr_protected :id, :updated_at, :created_at, :trend
|
#attr_protected :id, :updated_at, :created_at, :trend
|
||||||
attr_accessor :user
|
attr_accessor :user
|
||||||
|
|
||||||
belongs_to :team
|
belongs_to :team
|
||||||
|
|
|
@ -23,7 +23,7 @@ class DataFile < ActiveRecord::Base
|
||||||
MEGABYTE = 1048576
|
MEGABYTE = 1048576
|
||||||
|
|
||||||
attr_accessor :related_id
|
attr_accessor :related_id
|
||||||
attr_protected :id, :updated_at, :created_at, :path, :size, :md5
|
#attr_protected :id, :updated_at, :created_at, :path, :size, :md5
|
||||||
|
|
||||||
scope :recent, -> { order("created_at DESC").limit(8) }
|
scope :recent, -> { order("created_at DESC").limit(8) }
|
||||||
scope :demos, -> { order("created_at DESC").where("directory_id IN (SELECT id FROM directories WHERE parent_id = ?)", Directory::DEMOS) }
|
scope :demos, -> { order("created_at DESC").where("directory_id IN (SELECT id FROM directories WHERE parent_id = ?)", Directory::DEMOS) }
|
||||||
|
|
|
@ -22,7 +22,7 @@ class Directory < ActiveRecord::Base
|
||||||
MOVIES = 30
|
MOVIES = 30
|
||||||
ARTICLES = 39
|
ARTICLES = 39
|
||||||
|
|
||||||
attr_protected :id, :updated_at, :created_at, :path
|
#attr_protected :id, :updated_at, :created_at, :path
|
||||||
|
|
||||||
belongs_to :parent, :class_name => "Directory"
|
belongs_to :parent, :class_name => "Directory"
|
||||||
has_many :subdirs, :class_name => "Directory", :foreign_key => :parent_id
|
has_many :subdirs, :class_name => "Directory", :foreign_key => :parent_id
|
||||||
|
|
|
@ -17,7 +17,7 @@ class Forum < ActiveRecord::Base
|
||||||
BANS = 8
|
BANS = 8
|
||||||
TRASH = 12
|
TRASH = 12
|
||||||
|
|
||||||
attr_protected :id, :updated_at, :created_at
|
#attr_protected :id, :updated_at, :created_at
|
||||||
|
|
||||||
scope :public_forums, -> { select("forums.*")
|
scope :public_forums, -> { select("forums.*")
|
||||||
.joins("LEFT JOIN forumers ON forumers.forum_id = forums.id AND forumers.access = #{Forumer::ACCESS_READ}")
|
.joins("LEFT JOIN forumers ON forumers.forum_id = forums.id AND forumers.access = #{Forumer::ACCESS_READ}")
|
||||||
|
|
|
@ -22,7 +22,7 @@ class Gatherer < ActiveRecord::Base
|
||||||
|
|
||||||
include Extra
|
include Extra
|
||||||
|
|
||||||
attr_protected :id
|
#attr_protected :id
|
||||||
attr_accessor :confirm, :username
|
attr_accessor :confirm, :username
|
||||||
cattr_accessor :skip_callbacks
|
cattr_accessor :skip_callbacks
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ class Group < ActiveRecord::Base
|
||||||
GATHER_MODERATORS = 14
|
GATHER_MODERATORS = 14
|
||||||
CONTRIBUTORS = 16
|
CONTRIBUTORS = 16
|
||||||
|
|
||||||
attr_protected :id, :updated_at, :created_at, :founder_id
|
#attr_protected :id, :updated_at, :created_at, :founder_id
|
||||||
validates_length_of :name, :maximum => 20
|
validates_length_of :name, :maximum => 20
|
||||||
|
|
||||||
has_and_belongs_to_many :users
|
has_and_belongs_to_many :users
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
class Grouper < ActiveRecord::Base
|
class Grouper < ActiveRecord::Base
|
||||||
attr_protected :id, :created_at, :updated_at
|
#attr_protected :id, :created_at, :updated_at
|
||||||
attr_accessor :username
|
attr_accessor :username
|
||||||
|
|
||||||
belongs_to :group
|
belongs_to :group
|
||||||
|
|
|
@ -28,7 +28,7 @@ class Issue < ActiveRecord::Base
|
||||||
CATEGORY_GATHER = 54
|
CATEGORY_GATHER = 54
|
||||||
|
|
||||||
attr_accessor :assigned_name
|
attr_accessor :assigned_name
|
||||||
attr_protected :id, :created_at, :updated_at
|
#attr_protected :id, :created_at, :updated_at
|
||||||
|
|
||||||
has_many :comments, :as => :commentable
|
has_many :comments, :as => :commentable
|
||||||
belongs_to :category
|
belongs_to :category
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
class Map < ActiveRecord::Base
|
class Map < ActiveRecord::Base
|
||||||
include Extra
|
include Extra
|
||||||
|
|
||||||
attr_protected :id, :updated_at, :created_at, :deleted
|
#attr_protected :id, :updated_at, :created_at, :deleted
|
||||||
|
|
||||||
has_and_belongs_to_many :contests
|
has_and_belongs_to_many :contests
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ class Match < ActiveRecord::Base
|
||||||
include Exceptions
|
include Exceptions
|
||||||
|
|
||||||
attr_accessor :lineup, :method, :motm_name, :friendly
|
attr_accessor :lineup, :method, :motm_name, :friendly
|
||||||
attr_protected :id, :updated_at, :created_at, :diff, :points1, :points2
|
#attr_protected :id, :updated_at, :created_at, :diff, :points1, :points2
|
||||||
|
|
||||||
has_many :matchers, :dependent => :destroy
|
has_many :matchers, :dependent => :destroy
|
||||||
has_many :users, :through => :matchers
|
has_many :users, :through => :matchers
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
class Matcher < ActiveRecord::Base
|
class Matcher < ActiveRecord::Base
|
||||||
include Extra
|
include Extra
|
||||||
|
|
||||||
attr_protected :id, :updated_at, :created_at
|
#attr_protected :id, :updated_at, :created_at
|
||||||
|
|
||||||
belongs_to :match
|
belongs_to :match
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
class Message < ActiveRecord::Base
|
class Message < ActiveRecord::Base
|
||||||
include Extra
|
include Extra
|
||||||
|
|
||||||
attr_protected :id, :created_at, :updated_at
|
#attr_protected :id, :created_at, :updated_at
|
||||||
attr_accessor :sender_raw
|
attr_accessor :sender_raw
|
||||||
|
|
||||||
validates_length_of :title, :in => 1..100
|
validates_length_of :title, :in => 1..100
|
||||||
|
|
|
@ -29,7 +29,7 @@ class Movie < ActiveRecord::Base
|
||||||
VLC = "/usr/bin/vlc"
|
VLC = "/usr/bin/vlc"
|
||||||
LOCAL = "78.46.36.107:29100"
|
LOCAL = "78.46.36.107:29100"
|
||||||
|
|
||||||
attr_protected :id, :updated_at, :created_at
|
#attr_protected :id, :updated_at, :created_at
|
||||||
attr_accessor :user_name, :name, :stream_ip, :stream_port
|
attr_accessor :user_name, :name, :stream_ip, :stream_port
|
||||||
|
|
||||||
scope :recent, -> { limit(5) }
|
scope :recent, -> { limit(5) }
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
class Option < ActiveRecord::Base
|
class Option < ActiveRecord::Base
|
||||||
include Extra
|
include Extra
|
||||||
|
|
||||||
attr_protected :id, :updated_at, :created_at, :votes
|
#attr_protected :id, :updated_at, :created_at, :votes
|
||||||
|
|
||||||
validates_length_of :option, :in => 1..30
|
validates_length_of :option, :in => 1..30
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ class Poll < ActiveRecord::Base
|
||||||
|
|
||||||
default_scope -> { order("created_at DESC") }
|
default_scope -> { order("created_at DESC") }
|
||||||
|
|
||||||
attr_protected :id, :updated_at, :created_at, :votes, :user_id
|
#attr_protected :id, :updated_at, :created_at, :votes, :user_id
|
||||||
|
|
||||||
validates_length_of :question, :in => 1..50
|
validates_length_of :question, :in => 1..50
|
||||||
#validates_datetime :end_date
|
#validates_datetime :end_date
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
class Post < ActiveRecord::Base
|
class Post < ActiveRecord::Base
|
||||||
include Extra
|
include Extra
|
||||||
|
|
||||||
attr_protected :id, :updated_at, :created_at, :votes, :user_id
|
#attr_protected :id, :updated_at, :created_at, :votes, :user_id
|
||||||
|
|
||||||
scope :basic, -> {includes([{:user => [:team, :profile]}, :topic])}
|
scope :basic, -> {includes([{:user => [:team, :profile]}, :topic])}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
class Prediction < ActiveRecord::Base
|
class Prediction < ActiveRecord::Base
|
||||||
include Extra
|
include Extra
|
||||||
|
|
||||||
attr_protected :id, :created_at, :updated_at, :result
|
#attr_protected :id, :created_at, :updated_at, :result
|
||||||
|
|
||||||
validates_presence_of :match, :user
|
validates_presence_of :match, :user
|
||||||
validates_inclusion_of :score1, :in => 0..99, :message => "Invalid score"
|
validates_inclusion_of :score1, :in => 0..99, :message => "Invalid score"
|
||||||
|
|
|
@ -59,7 +59,7 @@
|
||||||
class Profile < ActiveRecord::Base
|
class Profile < ActiveRecord::Base
|
||||||
include Extra
|
include Extra
|
||||||
|
|
||||||
attr_protected :user_id, :id, :updated_at, :created_at
|
#attr_protected :user_id, :id, :updated_at, :created_at
|
||||||
|
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ class Server < ActiveRecord::Base
|
||||||
DOMAIN_NS2 = 2
|
DOMAIN_NS2 = 2
|
||||||
|
|
||||||
attr_accessor :pwd
|
attr_accessor :pwd
|
||||||
attr_protected :id, :user_id, :updated_at, :created_at, :map, :players, :maxplayers, :ping, :version
|
#attr_protected :id, :user_id, :updated_at, :created_at, :map, :players, :maxplayers, :ping, :version
|
||||||
|
|
||||||
validates_length_of [:name, :dns,], :in => 1..30
|
validates_length_of [:name, :dns,], :in => 1..30
|
||||||
validates_length_of [:password, :irc], :maximum => 30, :allow_blank => true
|
validates_length_of [:password, :irc], :maximum => 30, :allow_blank => true
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
class Shoutmsg < ActiveRecord::Base
|
class Shoutmsg < ActiveRecord::Base
|
||||||
include Extra
|
include Extra
|
||||||
|
|
||||||
attr_protected :id, :created_at, :updated_at, :user_id
|
#attr_protected :id, :created_at, :updated_at, :user_id
|
||||||
|
|
||||||
validates_length_of :text, :in => 1..100
|
validates_length_of :text, :in => 1..100
|
||||||
validates_presence_of :user
|
validates_presence_of :user
|
||||||
|
|
|
@ -24,7 +24,7 @@ class Team < ActiveRecord::Base
|
||||||
STATUS_INACTIVE = 0
|
STATUS_INACTIVE = 0
|
||||||
STATUS_ACTIVE = 1
|
STATUS_ACTIVE = 1
|
||||||
|
|
||||||
attr_protected :id, :active, :founder_id, :created_at, :updated_at
|
#attr_protected :id, :active, :founder_id, :created_at, :updated_at
|
||||||
|
|
||||||
validates_presence_of :name, :tag
|
validates_presence_of :name, :tag
|
||||||
validates_length_of :name, :tag, :in => 2..20
|
validates_length_of :name, :tag, :in => 2..20
|
||||||
|
|
|
@ -20,7 +20,7 @@ class Teamer < ActiveRecord::Base
|
||||||
RANK_DEPUTEE = 1
|
RANK_DEPUTEE = 1
|
||||||
RANK_LEADER = 2
|
RANK_LEADER = 2
|
||||||
|
|
||||||
attr_protected :id, :created_at, :updated_at, :version
|
#attr_protected :id, :created_at, :updated_at, :version
|
||||||
|
|
||||||
validates_length_of :comment, :in => 0..15, :allow_blank => true
|
validates_length_of :comment, :in => 0..15, :allow_blank => true
|
||||||
validates_uniqueness_of :user_id, :scope => [:team_id, :rank]
|
validates_uniqueness_of :user_id, :scope => [:team_id, :rank]
|
||||||
|
|
|
@ -20,7 +20,7 @@ class Topic < ActiveRecord::Base
|
||||||
RULES = 12
|
RULES = 12
|
||||||
|
|
||||||
include Extra
|
include Extra
|
||||||
attr_protected :id, :updated_at, :created_at
|
#attr_protected :id, :updated_at, :created_at
|
||||||
attr_accessor :first_post
|
attr_accessor :first_post
|
||||||
|
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
|
|
|
@ -28,7 +28,7 @@ class User < ActiveRecord::Base
|
||||||
|
|
||||||
VERIFICATION_TIME = 604800
|
VERIFICATION_TIME = 604800
|
||||||
|
|
||||||
attr_protected :id, :created_at, :updated_at, :lastvisit, :lastip, :password, :version
|
#attr_protected :id, :created_at, :updated_at, :lastvisit, :lastip, :password, :version
|
||||||
attr_accessor :raw_password
|
attr_accessor :raw_password
|
||||||
|
|
||||||
#attribute :lastvisit, :string, default: DateTime.now
|
#attribute :lastvisit, :string, default: DateTime.now
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
class Vote < ActiveRecord::Base
|
class Vote < ActiveRecord::Base
|
||||||
include Extra
|
include Extra
|
||||||
|
|
||||||
attr_protected :id, :updated_at, :created_at, :user_id
|
#attr_protected :id, :updated_at, :created_at, :user_id
|
||||||
|
|
||||||
validates_uniqueness_of :user_id, :scope => :votable_id
|
validates_uniqueness_of :user_id, :scope => :votable_id
|
||||||
validates_presence_of :user_id, :votable_id, :votable_type
|
validates_presence_of :user_id, :votable_id, :votable_type
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
class Week < ActiveRecord::Base
|
class Week < ActiveRecord::Base
|
||||||
include Extra
|
include Extra
|
||||||
|
|
||||||
attr_protected :id, :updated_at, :created_at
|
#attr_protected :id, :updated_at, :created_at
|
||||||
|
|
||||||
validates_presence_of :contest, :map1, :map2
|
validates_presence_of :contest, :map1, :map2
|
||||||
validates_length_of :name, :in => 1..30
|
validates_length_of :name, :in => 1..30
|
||||||
|
|
Loading…
Reference in a new issue