Skip to content

Support Related Models #2

@mbleigh

Description

@mbleigh

I was going to just write a patch myself but the code is a little more involved that I expected. This would be super-amazing if you could include fields from included related models. For example, if had a Message model that belonged to a user, I'd love to be able to do something like:

messages.includes(:user)[{user: :name}, :text]

This would give me the name field from the User model and the text field from the Message model. I'd even be happy just to take SQL-style table dot notation:

messages.includes(:user)['users.name', :text]

What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions