[Rails-core] [Feature][ActiveRecord] Finding Orphans

2018-11-27 Thread Tom Rossi
Its common for me to look for orphans and I typically do it like this: Child.eager_load(:parent).where(parents: { id: nil }) I would like to propose putting together a PR for something like this: Child.missing(:parent) Parent.missing(:children) Please let me know if others are interested in

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] [Feature][ActiveStorage] Pre-defined Variants

2018-11-27 Thread Abhishek Chandrasekhar
@kasper - Allowing the one-off options on a given variant is an even better approach and just as easily implementable. Thanks for the suggestion. > I’m not looking to see this through though, so you’d have to get George Claghorn or someone else on board for this ride. Totally understood :)

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] [Feature][ActiveStorage] Pre-defined Variants

2018-11-27 Thread Kasper Timm Hansen
I do remember proposing this at one point internally: has_one_attached :avatar do |attachable| attachable.variant :small, resize: ’100x100>’ … end I’m also fine with exposing it as `variant(:small)` or for one offs `variant(:small, caption: ’foo’)`. I’m not looking to see this through