mirror of
https://github.com/ENSL/ensl.org.git
synced 2024-12-26 12:30:48 +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_method :cuser, :strip, :return_here
|
||||
|
||||
before_filter :update_user
|
||||
before_filter :set_controller_and_action_names
|
||||
before_action :update_user
|
||||
before_action :set_controller_and_action_names
|
||||
|
||||
protect_from_forgery
|
||||
respond_to :html, :js
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
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
|
||||
@categories = Category.ordered.nospecial.domain Category::DOMAIN_ARTICLES
|
||||
|
@ -39,7 +39,8 @@ class ArticlesController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
@article = Article.new params[:article]
|
||||
@article = Article.new article_params
|
||||
([:article])
|
||||
@article.user = cuser
|
||||
raise AccessError unless @article.can_create? cuser
|
||||
|
||||
|
@ -53,7 +54,7 @@ class ArticlesController < ApplicationController
|
|||
|
||||
def update
|
||||
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)
|
||||
redirect_to @article
|
||||
else
|
||||
|
@ -79,4 +80,8 @@ class ArticlesController < ApplicationController
|
|||
def get_article
|
||||
@article = Article.find params[:id]
|
||||
end
|
||||
|
||||
def article_params
|
||||
params.require(:article).permit(:tite, :status, :category_id, :text, :user_id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class BansController < ApplicationController
|
||||
before_filter :get_ban, only: [:show, :edit, :update, :destroy]
|
||||
before_action :get_ban, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
def index
|
||||
@bans = Ban.ordered
|
||||
|
@ -32,7 +32,7 @@ class BansController < ApplicationController
|
|||
|
||||
def update
|
||||
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)
|
||||
redirect_to(@ban)
|
||||
else
|
||||
|
@ -51,4 +51,8 @@ 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class BracketsController < ApplicationController
|
||||
before_filter :get_bracket, only: [:show, :edit, :update, :destroy]
|
||||
before_action :get_bracket, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
def edit
|
||||
raise AccessError unless @bracket.can_update? cuser
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class CategoriesController < ApplicationController
|
||||
before_filter :get_category, except: [:index, :new, :create]
|
||||
before_action :get_category, except: [:index, :new, :create]
|
||||
|
||||
def show
|
||||
if [Category::DOMAIN_ARTICLES, Category::DOMAIN_NEWS].include? @category.domain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class ChallengesController < ApplicationController
|
||||
before_filter :get_challenge, only: [:show, :edit, :update, :destroy]
|
||||
before_action :get_challenge, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
def index
|
||||
@challenges = Challenge.all
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
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
|
||||
|
||||
def index
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
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
|
||||
@matches = Match.future.unfinished.ordered.of_contester @contester
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
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
|
||||
# @contests = Contest.all
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
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
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class DirectoriesController < ApplicationController
|
||||
before_filter :get_directory, except: [:new, :create]
|
||||
before_action :get_directory, except: [:new, :create]
|
||||
|
||||
def show
|
||||
if @directory.hidden
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
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'
|
||||
|
||||
def index
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class GatherersController < ApplicationController
|
||||
before_filter :get_gatherer, except: [:create]
|
||||
before_action :get_gatherer, except: [:create]
|
||||
|
||||
def create
|
||||
Gather.transaction do
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class GathersController < ApplicationController
|
||||
before_filter :get_gather, except: [:latest, :index, :create]
|
||||
before_action :get_gather, except: [:latest, :index, :create]
|
||||
respond_to :html, :js
|
||||
|
||||
def index
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class GroupsController < ApplicationController
|
||||
before_filter :get_group, except: [:index, :new, :create]
|
||||
before_action :get_group, except: [:index, :new, :create]
|
||||
|
||||
def index
|
||||
@groups = Group.all
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class IssuesController < ApplicationController
|
||||
before_filter :get_issue, only: [:show, :edit, :update, :destroy]
|
||||
before_action :get_issue, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
def index
|
||||
raise AccessError unless cuser and (cuser.admin? or cuser.moderator?)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class MapsController < ApplicationController
|
||||
before_filter :get_map, only: [:show, :edit, :update, :destroy]
|
||||
before_action :get_map, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
def index
|
||||
@maps = Map.basic
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class MatchProposalsController < ApplicationController
|
||||
before_filter :get_match
|
||||
before_action :get_match
|
||||
def index
|
||||
raise AccessError unless cuser.admin? || @match.user_in_match?(cuser)
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class MatchesController < ApplicationController
|
||||
before_filter :get_match, except: [:index, :new, :create, :admin]
|
||||
before_action :get_match, except: [:index, :new, :create, :admin]
|
||||
|
||||
def index
|
||||
@matches = Match.active
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class MessagesController < ApplicationController
|
||||
before_filter :get_message, only: [:show, :edit, :update, :destroy]
|
||||
before_action :get_message, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
def index
|
||||
raise AccessError unless cuser
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class MoviesController < ApplicationController
|
||||
before_filter :get_movie, except: [:index, :new, :create]
|
||||
before_action :get_movie, except: [:index, :new, :create]
|
||||
|
||||
def index
|
||||
@movies = Movie.filter_or_all(params[:filter], params[:order])
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class PollsController < ApplicationController
|
||||
before_filter :get_poll, except: [:index, :new, :create]
|
||||
before_action :get_poll, except: [:index, :new, :create]
|
||||
respond_to :js
|
||||
|
||||
def add
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class PollsController < ApplicationController
|
||||
before_filter :get_poll, except: [:index, :new, :create]
|
||||
before_action :get_poll, except: [:index, :new, :create]
|
||||
|
||||
def index
|
||||
@polls = Poll.all
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class PostsController < ApplicationController
|
||||
before_filter :get_post, except: [:new, :create]
|
||||
before_action :get_post, except: [:new, :create]
|
||||
respond_to :html, :js
|
||||
layout 'forums'
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class ServersController < ApplicationController
|
||||
before_filter :get_server, except: [:index, :refresh, :new, :create]
|
||||
before_action :get_server, except: [:index, :refresh, :new, :create]
|
||||
|
||||
def index
|
||||
@servers = Server.hlds.active.ordered.all :include => :user
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
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
|
||||
@teams = Team.search(params[:search]).paginate(per_page: 80, page: params[:page]).ordered
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
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'
|
||||
|
||||
def index
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
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
|
||||
|
||||
def index
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class VersionsController < ApplicationController
|
||||
before_filter :get_article
|
||||
before_action :get_article
|
||||
|
||||
def index
|
||||
@versions = @article.versions
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class WeeksController < ApplicationController
|
||||
before_filter :get_week, except: [:new, :create]
|
||||
before_action :get_week, except: [:new, :create]
|
||||
|
||||
def new
|
||||
@week = Week.new
|
||||
|
|
|
@ -34,8 +34,6 @@ class Article < ActiveRecord::Base
|
|||
G_RULES = 464
|
||||
COMPMOD = 998
|
||||
|
||||
attr_protected :id, :updated_at, :created_at, :user_id, :version
|
||||
|
||||
scope :recent, -> { order('created_at DESC').limit(8) }
|
||||
scope :with_comments, -> {
|
||||
select("articles.*, COUNT(C.id) AS comment_num").
|
||||
|
|
|
@ -26,7 +26,7 @@ class Ban < ActiveRecord::Base
|
|||
TYPE_GATHER = 5
|
||||
VENT_BANS = "tmp/bans.txt"
|
||||
|
||||
attr_protected :id, :created_at, :updated_at
|
||||
#attr_protected :id, :created_at, :updated_at
|
||||
attr_accessor :len, :user_name
|
||||
|
||||
scope :ordered, -> {order("created_at DESC")}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
class Bracket < ActiveRecord::Base
|
||||
include Extra
|
||||
|
||||
attr_protected :id, :created_at, :updated_at
|
||||
#attr_protected :id, :created_at, :updated_at
|
||||
|
||||
belongs_to :contest
|
||||
has_many :bracketers
|
||||
|
|
|
@ -16,7 +16,7 @@ class Bracketer < ActiveRecord::Base
|
|||
include Exceptions
|
||||
include Extra
|
||||
|
||||
attr_protected :id, :updated_at, :created_at
|
||||
#attr_protected :id, :updated_at, :created_at
|
||||
|
||||
belongs_to :contest
|
||||
belongs_to :match
|
||||
|
|
|
@ -28,7 +28,7 @@ class Category < ActiveRecord::Base
|
|||
|
||||
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
|
||||
validate :validate_domain
|
||||
|
|
|
@ -34,7 +34,7 @@ class Challenge < ActiveRecord::Base
|
|||
ACCEPT_BEFORE_VOLUNTARY = 300 # Time to accept before voluntary match time: 5 mins
|
||||
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 :map2, :on => :update
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
class Comment < ActiveRecord::Base
|
||||
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 :recent, -> (n) { order("id DESC").limit(n) }
|
||||
|
|
|
@ -33,7 +33,7 @@ class Contest < ActiveRecord::Base
|
|||
TYPE_LEAGUE = 1
|
||||
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 :inactive, -> { where(status: STATUS_CLOSED) }
|
||||
|
|
|
@ -23,7 +23,7 @@ class Contester < ActiveRecord::Base
|
|||
TREND_UP = 1
|
||||
TREND_DOWN = 2
|
||||
|
||||
attr_protected :id, :updated_at, :created_at, :trend
|
||||
#attr_protected :id, :updated_at, :created_at, :trend
|
||||
attr_accessor :user
|
||||
|
||||
belongs_to :team
|
||||
|
|
|
@ -23,7 +23,7 @@ class DataFile < ActiveRecord::Base
|
|||
MEGABYTE = 1048576
|
||||
|
||||
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 :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
|
||||
ARTICLES = 39
|
||||
|
||||
attr_protected :id, :updated_at, :created_at, :path
|
||||
#attr_protected :id, :updated_at, :created_at, :path
|
||||
|
||||
belongs_to :parent, :class_name => "Directory"
|
||||
has_many :subdirs, :class_name => "Directory", :foreign_key => :parent_id
|
||||
|
|
|
@ -17,7 +17,7 @@ class Forum < ActiveRecord::Base
|
|||
BANS = 8
|
||||
TRASH = 12
|
||||
|
||||
attr_protected :id, :updated_at, :created_at
|
||||
#attr_protected :id, :updated_at, :created_at
|
||||
|
||||
scope :public_forums, -> { select("forums.*")
|
||||
.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
|
||||
|
||||
attr_protected :id
|
||||
#attr_protected :id
|
||||
attr_accessor :confirm, :username
|
||||
cattr_accessor :skip_callbacks
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ class Group < ActiveRecord::Base
|
|||
GATHER_MODERATORS = 14
|
||||
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
|
||||
|
||||
has_and_belongs_to_many :users
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
|
||||
class Grouper < ActiveRecord::Base
|
||||
attr_protected :id, :created_at, :updated_at
|
||||
#attr_protected :id, :created_at, :updated_at
|
||||
attr_accessor :username
|
||||
|
||||
belongs_to :group
|
||||
|
|
|
@ -28,7 +28,7 @@ class Issue < ActiveRecord::Base
|
|||
CATEGORY_GATHER = 54
|
||||
|
||||
attr_accessor :assigned_name
|
||||
attr_protected :id, :created_at, :updated_at
|
||||
#attr_protected :id, :created_at, :updated_at
|
||||
|
||||
has_many :comments, :as => :commentable
|
||||
belongs_to :category
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
class Map < ActiveRecord::Base
|
||||
include Extra
|
||||
|
||||
attr_protected :id, :updated_at, :created_at, :deleted
|
||||
#attr_protected :id, :updated_at, :created_at, :deleted
|
||||
|
||||
has_and_belongs_to_many :contests
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ class Match < ActiveRecord::Base
|
|||
include Exceptions
|
||||
|
||||
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 :users, :through => :matchers
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
class Matcher < ActiveRecord::Base
|
||||
include Extra
|
||||
|
||||
attr_protected :id, :updated_at, :created_at
|
||||
#attr_protected :id, :updated_at, :created_at
|
||||
|
||||
belongs_to :match
|
||||
belongs_to :user
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
class Message < ActiveRecord::Base
|
||||
include Extra
|
||||
|
||||
attr_protected :id, :created_at, :updated_at
|
||||
#attr_protected :id, :created_at, :updated_at
|
||||
attr_accessor :sender_raw
|
||||
|
||||
validates_length_of :title, :in => 1..100
|
||||
|
|
|
@ -29,7 +29,7 @@ class Movie < ActiveRecord::Base
|
|||
VLC = "/usr/bin/vlc"
|
||||
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
|
||||
|
||||
scope :recent, -> { limit(5) }
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
class Option < ActiveRecord::Base
|
||||
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
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ class Poll < ActiveRecord::Base
|
|||
|
||||
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_datetime :end_date
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
class Post < ActiveRecord::Base
|
||||
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])}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
class Prediction < ActiveRecord::Base
|
||||
include Extra
|
||||
|
||||
attr_protected :id, :created_at, :updated_at, :result
|
||||
#attr_protected :id, :created_at, :updated_at, :result
|
||||
|
||||
validates_presence_of :match, :user
|
||||
validates_inclusion_of :score1, :in => 0..99, :message => "Invalid score"
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
class Profile < ActiveRecord::Base
|
||||
include Extra
|
||||
|
||||
attr_protected :user_id, :id, :updated_at, :created_at
|
||||
#attr_protected :user_id, :id, :updated_at, :created_at
|
||||
|
||||
belongs_to :user
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ class Server < ActiveRecord::Base
|
|||
DOMAIN_NS2 = 2
|
||||
|
||||
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 [:password, :irc], :maximum => 30, :allow_blank => true
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
class Shoutmsg < ActiveRecord::Base
|
||||
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_presence_of :user
|
||||
|
|
|
@ -24,7 +24,7 @@ class Team < ActiveRecord::Base
|
|||
STATUS_INACTIVE = 0
|
||||
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_length_of :name, :tag, :in => 2..20
|
||||
|
|
|
@ -20,7 +20,7 @@ class Teamer < ActiveRecord::Base
|
|||
RANK_DEPUTEE = 1
|
||||
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_uniqueness_of :user_id, :scope => [:team_id, :rank]
|
||||
|
|
|
@ -20,7 +20,7 @@ class Topic < ActiveRecord::Base
|
|||
RULES = 12
|
||||
|
||||
include Extra
|
||||
attr_protected :id, :updated_at, :created_at
|
||||
#attr_protected :id, :updated_at, :created_at
|
||||
attr_accessor :first_post
|
||||
|
||||
belongs_to :user
|
||||
|
|
|
@ -28,7 +28,7 @@ class User < ActiveRecord::Base
|
|||
|
||||
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
|
||||
|
||||
#attribute :lastvisit, :string, default: DateTime.now
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
class Vote < ActiveRecord::Base
|
||||
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_presence_of :user_id, :votable_id, :votable_type
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
class Week < ActiveRecord::Base
|
||||
include Extra
|
||||
|
||||
attr_protected :id, :updated_at, :created_at
|
||||
#attr_protected :id, :updated_at, :created_at
|
||||
|
||||
validates_presence_of :contest, :map1, :map2
|
||||
validates_length_of :name, :in => 1..30
|
||||
|
|
Loading…
Reference in a new issue