Re: [Rails-core] Re: [ActiveStorage] Feature Request: attachment validations

2019-02-21 Thread Abhishek Chandrasekhar
Hey everyone! It seems this has been open for a while, and as per George's last statement I'm assuming a pull request is still welcome? If so I've been working on this the past few days  (As a small side note, there does already seem to be a PR open but I provided my thoughts on that here.

Re: [Rails-core] Re: [ActiveStorage] Feature Request: attachment validations

2018-11-27 Thread ifomichev
Hi George, thanks for your positive feedback! I'll see how far I can get :) Best regards, Ivan On Tuesday, November 27, 2018 at 4:21:28 PM UTC+1, George Claghorn wrote: > > Validations are planned for Rails 6. Here’s a rough sketch of the API I > have in mind: > > validates_attached :logo,

Re: [Rails-core] Re: [ActiveStorage] Feature Request: attachment validations

2018-11-27 Thread George Claghorn
Validations are planned for Rails 6. Here’s a rough sketch of the API I have in mind: validates_attached :logo, presence: true, byte_size: { less_than: 10.megabytes, message: "must be smaller than 10 MB" }, content_type: /\Aimage\// I intended to implement this myself, and laid the

Re: [Rails-core] Re: [ActiveStorage] Feature Request: attachment validations

2018-11-26 Thread ifomichev
Hmmm... Hi Rob, thanks for your reply! I see how one can validate presence of a blob from this change, but I'm not sure what could be the syntax for validating content type, filename, or file size after this change. Could you please elaborate on that? The commit you referred to provides

Re: [Rails-core] Re: [ActiveStorage] Feature Request: attachment validations

2018-11-26 Thread Rob Zolkos
Rails 6 will have validations for AS https://github.com/rails/rails/commit/e8682c5bf051517b0b265e446aa1a7eccfd47bf7#diff-c76fb6202b7f95a08fe12f40c4999ac9R11 On Mon, Nov 26, 2018 at 3:36 PM wrote: > Hi all, > > I think this is one of the essential features that are missing in Active > Storage.

[Rails-core] Re: [ActiveStorage] Feature Request: attachment validations

2018-11-26 Thread ifomichev
Hi all, I think this is one of the essential features that are missing in Active Storage. Thus I'm pretty sure it's gonna be implemented pretty soon one way or another, and I wonder what is the maintainers' plan for it, if there is any. I know about active_storage_validations gem, but its

[Rails-core] Re: [ActiveStorage] Feature Request: attachment validations

2018-05-23 Thread Luis Felipe Sanchez
I think this would be a great feature to have. Looking around the code I find that one main issue is that doing attribute assignment like `@record.file=attachable` uploads the attachable to the service right away. We could make it so that `ActiveStorage::Attached` stores the attachable as an