2014-10-20 81 views

回答

4

我想通了。所有你必須改變的是對^ & &

private 
def time_or_money 
    if time.blank? && money.blank? 
    errors[:base] << "Specify Time, Money or Both." 
    end 
end 
5

沒有爲Rails 4短選項(不知道的Rails 3):

validates :email, presence: { if: -> { username.blank? } } 
validates :username, presence: { if: -> { email.blank? } } 
相關問題