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

Adding order method to active query to support several argument formats #58

Merged

Conversation

swpreethi
Copy link
Contributor

@swpreethi swpreethi commented May 25, 2023

Add order method to active query that accepts arguments in one of several formats ( symbol, string that has raw soql)

  • By default, the order is ascending. For descending order, you can map the column name symbol to :desc

Use-cases:

User.order(:name)
User.order(email: :desc)
User.order(:name, email: :desc)
User.order('name')

Copy link
Contributor

@JeffLuckett JeffLuckett left a comment

Choose a reason for hiding this comment

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

This looks good. Please update CHANGELOG.md and add this PR under "unreleased".

Copy link
Contributor

@JeffLuckett JeffLuckett left a comment

Choose a reason for hiding this comment

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

Just a little cleanup, then I'll approve.

CHANGELOG.md Outdated
@@ -2,6 +2,11 @@

## Not released

## 0.14.1
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove line 5, just leave it as "Not released". We'll package a few changes together before we release.

- Add `#order` method to active query that accepts arguments in several formats ( symbol, string that has raw soql) (https://github.com/Beyond-Finance/active_force/pull/58)
- By default, the order is ascending. For descending order, you can map the column name symbol to :desc
- use-cases: User.order(:name), User.order(email: :desc), User.order(:name, email: :desc), User.order('name')

Copy link
Contributor

Choose a reason for hiding this comment

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

Remove line 7&8. Just need the info on line 6.

Feel free to add info to README.md if you feel additional documentation is necessary, but since this pretty much follows the AR implementation, probably not necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it, Would update them

@swpreethi swpreethi requested a review from JeffLuckett May 26, 2023 14:48
@JeffLuckett JeffLuckett merged commit 22c4cfb into main May 26, 2023
@JeffLuckett JeffLuckett deleted the feature/override-order-by-to-support-symbols-and-order-type branch May 26, 2023 15:41
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.

2 participants