Removed unused accessors and validation

This commit is contained in:
Christopher Blanchard 2015-05-22 13:56:25 +01:00 committed by Chris Blanchard
parent 98c69b6e9a
commit 087cef15f2

View file

@ -27,13 +27,12 @@ class Ban < ActiveRecord::Base
VENT_BANS = "tmp/bans.txt"
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 :effective, conditions: "expiry > UTC_TIMESTAMP()"
scope :ineffective, conditions: "expiry < UTC_TIMESTAMP()"
validate :validate_ts
validate :validate_type
validate :validate_ventban
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"}
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
errors.add :ban_type, I18n.t(:invalid_ban_type) unless types.include? ban_type
end