ActiveStorage validations

71 views
Skip to first unread message

Tobias Sandelius

unread,
Sep 1, 2017, 5:09:37 PM9/1/17
to Ruby on Rails: Talk
I can't find any docs about attachment validations. Are there any? If not, will it be added?

Hassan Schroeder

unread,
Sep 1, 2017, 6:15:59 PM9/1/17
to rubyonrails-talk
On Fri, Sep 1, 2017 at 11:09 AM, Tobias Sandelius <tob...@sandeli.us> wrote:
> I can't find any docs about attachment validations. Are there any? If not,
> will it be added?

Given that the Rails guide

http://guides.rubyonrails.org/form_helpers.html#uploading-files

references external (non-rails) gems for managing uploaded files
I'd guess the answer to both those is no :-)

Seems like a worthwhile gem idea, though.

--
Hassan Schroeder ------------------------ hassan.s...@gmail.com
twitter: @hassan
Consulting Availability : Silicon Valley or remote

Tobias Sandelius

unread,
Sep 2, 2017, 2:52:46 AM9/2/17
to Ruby on Rails: Talk
The new ActiveStorage framework in Rails 5.2 provide just that, I just cant find anything about validating them.

Carlos Ramirez

unread,
Sep 25, 2018, 5:04:32 PM9/25/18
to Ruby on Rails: Talk
The initial release of Active Storage (as part of Rails 5.2) did not include the ability to validate attachments

Validations are intended to be a part of the Rails 6 release. Work to support this has already begun

In the meantime, if you need validations for Active Storage attachments right now, you can roll your own using custom validators. I have written a few blog posts on the subject that you might find helpful:
Hope that helps!
Reply all
Reply to author
Forward
0 new messages