瀏覽代碼

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)