app/models/guide.rb
# Validates the size of an uploaded image.
Validates the size of an uploaded image.
Validates the size of an uploaded image .
def thumbnail_size
      unless thumbnail.size.nil?
        if thumbnail.size > 5.megabytes
          errors.add(:picture, "should be less than 5MB")
        end
      end
    end
def thumbnail_size unless thumbnail . size . nil? if thumbnail . size > 5 . megabytes errors . add ( :picture , "should be less than 5MB" ) end end end
Validates the size of an uploaded image.
Validates the size of an uploaded image .