mirror of
https://github.com/ENSL/ensl.org.git
synced 2024-12-27 21:10:54 +00:00
Removed unused accessors and validation
This commit is contained in:
parent
98c69b6e9a
commit
087cef15f2
1 changed files with 1 additions and 8 deletions
|
@ -27,13 +27,12 @@ class Ban < ActiveRecord::Base
|
||||||
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 :ts, :sign, :len, :user_name
|
attr_accessor :len, :user_name
|
||||||
|
|
||||||
scope :ordered, order: "created_at DESC"
|
scope :ordered, order: "created_at DESC"
|
||||||
scope :effective, conditions: "expiry > UTC_TIMESTAMP()"
|
scope :effective, conditions: "expiry > UTC_TIMESTAMP()"
|
||||||
scope :ineffective, conditions: "expiry < UTC_TIMESTAMP()"
|
scope :ineffective, conditions: "expiry < UTC_TIMESTAMP()"
|
||||||
|
|
||||||
validate :validate_ts
|
|
||||||
validate :validate_type
|
validate :validate_type
|
||||||
validate :validate_ventban
|
validate :validate_ventban
|
||||||
validates_format_of :steamid, with: /\A([0-9]{1,10}:){2}[0-9]{1,10}\Z/, allow_blank: true
|
validates_format_of :steamid, with: /\A([0-9]{1,10}:){2}[0-9]{1,10}\Z/, allow_blank: true
|
||||||
|
@ -58,12 +57,6 @@ class Ban < ActiveRecord::Base
|
||||||
TYPE_GATHER => "Gather"}
|
TYPE_GATHER => "Gather"}
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate_ts
|
|
||||||
if ts and Verification.verify(steamid + ts.to_s) != sign
|
|
||||||
errors.add :ts, I18n.t(:wrong_verification_code)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def validate_type
|
def validate_type
|
||||||
errors.add :ban_type, I18n.t(:invalid_ban_type) unless types.include? ban_type
|
errors.add :ban_type, I18n.t(:invalid_ban_type) unless types.include? ban_type
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue