Hi there!

I am writing a new option for `has_many` associations. It generates 
additionnal has_many for each given association scope.

    # Before
    has_many :posts
    has_many :published_posts, -> { published }, class_name: "Post"

    # After
    has_many :posts, new_option: [:published]


*Why*
In my rails projects, I really often write a lot of `has_many` variations 
to be able to use fine-grained preload. Eg: 
`Author.all.preload(:published_post).each do [...]`.

It would be handful to have syntaxic sugar to shorten all theses `has_many`

*What I've done*
https://github.com/Bahanix/rails/commit/15ec54d175a8936e8f1017a77a160760c8fb92a2
I am very unsure about my `compose` option name (I am not a native english 
speaker).
Does the feature seems useful to you / relevant for an ActiveRecord PR?

Thank you for reading :)
Julien Grillot

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to