lib/is_reviewable/reviewable.rb
# Check if the requested reviewer object is a valid reviewer.
#
Check if the requested reviewer object is a valid reviewer.
Check if the requested reviewer object is a valid reviewer .
def validate_reviewer(identifiers)
          raise InvalidReviewerError, "Argument can't be nil: no reviewer object or IP provided." if identifiers.blank?
          reviewer = identifiers[:by] || identifiers[:reviewer] || identifiers[:user] || identifiers[:ip]
          is_ip = Support.is_ip?(reviewer)
          reviewer = reviewer.to_s.strip if is_ip
          unless Support.is_active_record?(reviewer) || is_ip
            raise InvalidReviewerError, "Reviewer is of wrong type: #{reviewer.inspect}."
          end
          raise InvalidReviewerError, "Reviewing based on IP is disabled." if is_ip && !self.is_reviewable_options[:accept_ip]
          reviewer
        end
def validate_reviewer ( identifiers ) raise InvalidReviewerError , "Argument can't be nil: no reviewer object or IP provided." if identifiers . blank? reviewer = identifiers [ :by ] || identifiers [ :reviewer ] || identifiers [ :user ] || identifiers [ :ip ] is_ip = Support . is_ip? ( reviewer ) reviewer = reviewer . to_s . strip if is_ip unless Support . is_active_record? ( reviewer ) || is_ip raise InvalidReviewerError , "Reviewer is of wrong type: #{reviewer.inspect}." end raise InvalidReviewerError , "Reviewing based on IP is disabled." if is_ip && ! self . is_reviewable_options [ :accept_ip ] reviewer end
Check if the requested reviewer object is a valid reviewer.
Check if the requested reviewer object is a valid reviewer .
identifiers
<not_specific>