class RailsParam::Validator::Blank

Public Instance Methods

valid_value?() click to toggle source
# File lib/rails_param/validator/blank.rb, line 4
def valid_value?
  return false if parameter.options[:blank]

  case value
  when String
    (/\S/ === value)
  when Array, Hash, ActionController::Parameters
    !value.empty?
  else
    !value.nil?
  end
end

Private Instance Methods

error_message() click to toggle source
# File lib/rails_param/validator/blank.rb, line 19
def error_message
  "Parameter #{name} cannot be blank"
end