flyerhzm/rails_best_practices — Issue #81: remove unused methods ignores validate
Author: artemk
Created: 2011-11-26 13:32:17+00:00
State: open

class User < ActiveRecord::Base

validate :valid_birth_date

private

def valid_birth_date
return if birth_date.blank?
errors.add(:birth_date, :invalid) unless Time.gm(1900) <= birth_date
errors.add(:birth_date, :too_young) unless birth_date < Date.today - 16.years
end
end

rails_best_practices .
./app/models/user.rb:33 - remove unused methods (User#valid_birth_date)