8000 Custom sort order for model annotation · Issue #610 · ctran/annotate_models · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Custom sort order for model annotation #610
Open
@lucker14-zz

Description

@lucker14-zz

We would love to implement custom sort to this gem. It should let you decide the order of output, because sometimes you don't want the order given in classified sort.

How I would do that:
Add new option parameters 'sort_order' - array representing the order of output e.g. ['pk', 'associations', 'rest_cols', 'timestamps'] and boolean param 'custom_sort'.
The sort method could be almost entirely same as classified_sort, only difference being the last line where instead of

([id] << rest_cols << timestamps << associations).flatten.compact
would be something like

(sort_order[0] << sort_order[1] << sort_order[2] << sort_order[3]).flatten.compact

I am able to make this PR if you're interested.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0