Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

order clause refactoring, allow to use custom sql ordering strategies #4768

Merged
merged 1 commit into from
Jan 30, 2017

Conversation

Fivell
Copy link
Member

@Fivell Fivell commented Jan 28, 2017

fixes #1590
fixes #3085

  • added ability to use custom class for handling ordering per resource
      ActiveAdmin.register Post do
        config.order_clause = MyOrderClause
      end
    
  • added dsl to customize ordering strategy per column
    ActiveAdmin.register User do
      order_by(:full_name) do |order_clause|
        ['COALESCE(NULLIF(last_name, ''), first_name), first_name', order_clause.order].join(' ')
      end
    end

Copy link
Member

@timoschilling timoschilling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add some line to the docs and a line into the changelog

  - added ability to use custom class for handling ordering per resource

  eg

  ```
    ActiveAdmin.register Post do
      config.order_clause = MyOrderClause
    end
  ```

  - added dsl to customize ordering strategy per column
  eg

  ```
    ActiveAdmin.register Post do
      order_by(:full_name) do |order_clause|
        ['COALESCE(NULLIF(last_name, ''), first_name), first_name', order_clause.order].join(' ')
      end
    end
  ```
@Fivell
Copy link
Member Author

Fivell commented Jan 30, 2017

@timoschilling , take a look pls

@Fivell Fivell merged commit ab72c33 into activeadmin:master Jan 30, 2017
@Fivell Fivell deleted the order_clause branch April 24, 2017 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

custom sort on custom column in index ? Order with Nulls Last
2 participants