소스 검색

Validate a little nicer

Glenn 'devalias' Grant 10 년 전
부모
커밋
4b48a6e578
1개의 변경된 파일2개의 추가작업 그리고 4개의 파일을 삭제
  1. 2 4
      app/models/agents/twitter_user_agent.rb

+ 2 - 4
app/models/agents/twitter_user_agent.rb

@@ -63,10 +63,8 @@ module Agents
     end
 
     def validate_options
-      unless options['username'].present? &&
-        options['expected_update_period_in_days'].present?
-        errors.add(:base, "username and expected_update_period_in_days are required")
-      end
+      errors.add(:base, "username is required") unless options['username'].present?
+      errors.add(:base, "expected_update_period_in_days is required") unless options['expected_update_period_in_days'].present?
 
       if options[:include_retweets].present? &&
         !(!!options[:include_retweets] === true || !!options[:include_retweets] === false)