• Stars
    star
    207
  • Rank 182,575 (Top 4 %)
  • Language
    Ruby
  • License
    MIT License
  • Created over 5 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

ActiveStorage blob validator.

Gem Version Build

ActiveStorage Validator

ActiveStorage blob validator.

Installation

Add this line to your application's Gemfile:

gem 'activestorage-validator'

And then execute:

$ bundle

Or install it yourself as:

$ gem install activestorage-validator

Usage

class User < ApplicationRecord
  has_one_attached :avatar
  has_many_attached :photos

  validates :avatar, presence: true, blob: { content_type: :web_image } # supported options: :web_image, :image, :audio, :video, :text
  validates :photos, presence: true, blob: { content_type: ['image/png', 'image/jpg', 'image/jpeg'], size_range: 1..(5.megabytes) }
  # validates :photos, presence: true, blob: { content_type: %r{^image/}, size_range: 1..(5.megabytes) }
end

Note: For has_many_attached, size is validated on each file individually. In the code above, :photos validation allows any number of photos to be upload, each one being 5 MB or less in size.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/aki77/activestorage-validator. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

More Repositories

1

atom-expand-region

expanding selection
CoffeeScript
90
star
2

csb

A simple and streaming support CSV template engine for Ruby on Rails.
Ruby
41
star
3

simplecov-report-action

A GitHub Action that report simplecov coverage.
TypeScript
39
star
4

initial_avatar

Create Gmail like text avatars for profile pictures using SVG.
Ruby
31
star
5

rails-template-inspector

TypeScript
31
star
6

hanmoto

Public pages management with Asset Pipeline.
Ruby
30
star
7

atom-gist

create and insert Gists
CoffeeScript
29
star
8

atom-clipboard-plus

Keeps your clipboard history.
CoffeeScript
17
star
9

vscode-rails-routes

Definition and Completion provider for Rails Routes.
TypeScript
13
star
10

atom-autocomplete-ctags

Autocomplete-plus provider for ctags
CoffeeScript
10
star
11

vscode-rails-db-schema

Definition and Completion provider for Rails DB Schema.
TypeScript
9
star
12

undercover-checkstyle

Undercover checkstyle reporter.
Ruby
8
star
13

atom-source-preview

Source Preview for Atom
CoffeeScript
8
star
14

zsh-completion

zsh completion. symfony, pear
7
star
15

vscode-haml-lint

Haml Lint for Visual Studio Code
TypeScript
6
star
16

vscode-rails-i18n

Completion and Hover provider for Rails I18n.
TypeScript
6
star
17

activemodel-csv_validator

CSV Validator for Active Model
Ruby
5
star
18

vscode-rails-partial

Definition and Completion provider for Rails Partial.
TypeScript
5
star
19

bulma_form_builder

Rails form builder
Ruby
5
star
20

new-gems-action

Add a message in Pull Request with basic information when new gems are added.
TypeScript
4
star
21

vscode-rails-view-component

Completion provider for Rails ViewComponent.
TypeScript
4
star
22

vscode-rubocop-quick-fix

Quick fix for Rubocop warnings.
TypeScript
4
star
23

atom-input-dialog

Atom input dialog
JavaScript
4
star
24

changed-lines-number-action

TypeScript
3
star
25

vscode-rails-extension-pack

The collection of extensions for working with Rails in VS Code.
3
star
26

vscode-html-erb

TypeScript
3
star
27

Propel-Behavior

Propel Behavior
PHP
3
star
28

atom-autosave-plus

Autosave with some extensions
CoffeeScript
3
star
29

atom-source-preview-pug

source-preview provider for pug
CoffeeScript
2
star
30

atom-view-mode

read only mode
CoffeeScript
2
star
31

mojiru

Provides japanese conversion functionality for Strings using Ruby Refinements.
Ruby
2
star
32

delete-pr-comments-action

Delete PR review comments by any conditions
TypeScript
2
star
33

atom-env-from-shell

Make Atom use the $PATH set up by the user's shell
CoffeeScript
2
star
34

atom-vim-mode-clipboard-plus

Add clipboard-plus feature to vim-mode
CoffeeScript
2
star
35

atom-source-preview-babel

source-preview provider for babel
CoffeeScript
2
star
36

vscode-autocomplete-symbols

Completion provider for symbols.
TypeScript
2
star
37

atom-smartchr

Insert several candidates with a single key
CoffeeScript
2
star
38

atom-sequential-command

Many commands into one command
CoffeeScript
2
star
39

atom-source-preview-react

source-preview provider for react
CoffeeScript
2
star
40

atom-disable-grammars

Disables grammars
CoffeeScript
1
star
41

typescript-plugin-import-filter

Exclude specific modules from auto import in typescript.
TypeScript
1
star
42

atom-erd

No longer maintenance.
JavaScript
1
star
43

atom-kobito-tools

Kobito.app tools
CoffeeScript
1
star
44

expiring-todo-comments-action

Add expiration conditions to TODO comments
TypeScript
1
star
45

atom-rails-db-scheme

Autocomplete+ provider for Rails db schema
JavaScript
1
star
46

atom-snippet-generator-plus

Generate snippet from code
JavaScript
1
star
47

oembed-element

oEmbed web component
TypeScript
1
star
48

atom-make-executable

Make executable
CoffeeScript
1
star
49

atom-dict

Dictionary.app interface for Atom
Objective-C
1
star
50

atom-open-html-in-browser

HTML files will open in your default browser
CoffeeScript
1
star
51

atom-github-search

Github search for selected text
JavaScript
1
star
52

vscode-tiny-emacs

A tiny emacs like extension in the VS Code.
TypeScript
1
star
53

eco-browserify

eco browserify plugin
JavaScript
1
star
54

safer_initialize

Make ActiveRecord initialization less dangerous.
Ruby
1
star
55

atom-rails-i18n-plus

Autocomplete+ provider for Rails I18n
JavaScript
1
star
56

atom-auto-run

When Atom finishes loading, it will dispatch.
CoffeeScript
1
star
57

vscode-copy-relative-file-path-with-line

Copy relative file path with line number.
TypeScript
1
star
58

vscode-vue-dts-gen

Creates .d.ts files from `.vue` files in VS Code.
TypeScript
1
star
59

akWebDebugPanelPropel

sfWebDebugPanelPropel ใซ Explain ใฎ็ตๆžœใ‚’่ฟฝๅŠ ่กจ็คบ
PHP
1
star
60

atom-rails-routes

Autocomplete+ and hyperclick provider for Rails routes
JavaScript
1
star
61

atom-japan-util

utilities for Japanese
CoffeeScript
1
star
62

vscode-autocomplete-words

Create completion items from other open files.
TypeScript
1
star