Sha256: 261af11eccd0937f2f8ca92a0e9a9377dfb83f5327140b172a9b433d7f24ef6b

Contents?: true

Size: 467 Bytes

Versions: 1

Compression:

Stored size: 467 Bytes

Contents

module RailsUploads
  module Validators
    class Base < ActiveModel::EachValidator
      
      protected
    
      def has_default?(record, attribute)
        options = record.class.instance_variable_get('@attachments')[attribute]
        options.has_key?(:default)
      end
      
      def add_error(record, attribute, type, options={})
        record.errors[attribute] << (options[:message] || I18n.t(type, options))        
      end
      
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails_uploads-0.1.4 lib/rails_uploads/validators/base.rb