Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert change on ActiveRecord::Relation#order method that prepends new
order on the old ones The previous behavior added a major backward incompatibility since it impossible to have a upgrade path without major changes on the application code. We are taking the most conservative path to be consistent with the idea of having a smoother upgrade on Rails 4. We are reverting the behavior for what was in Rails 3.x and, if needed, we will implement a new API to prepend the order clauses in Rails 4.1. Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/relation/query_methods.rb guides/source/upgrading_ruby_on_rails.md
- Loading branch information
1 parent
d1ecd40
commit 609dae1
Showing
8 changed files
with
35 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
609dae1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rafaelfranca: can you tell more about the "we will implement a new API to prepend the order clauses in
Rails 4.1"? I have a Rails 4.0 app that uses the new ordering and now it will be hard to migrate from 4.0.0 to 4.0.1. You made it easier to go from 3 to 4 but from 4 to 4.0.1 now sucks...
Maybe it would be better to allow us to change how it behaves on an app level (config)?
Monkey patch for that (put it into your initializers):
609dae1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already know we would made harder to upgrade from 4.0.0 to 4.0.1, but the number of affected applications would be less than people migrating from 3. The new API will be only added on 4.1 and I don't think is worth to add configuration to this since
reorder
can give you the old behavior.609dae1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rafaelfranca : thx, can you say, what are you planning to do in 4.1?
609dae1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We didn't discussed this yet, but maybe will be something like
prepend_order
. Maybe instead of monkey patching order you can add this new method. Fell free to ping me if you are having problem with this change and could not make it work withreorder
or with mokey path/new method. I'd like to help.609dae1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rafaelfranca: monkey patch works exactly as expected. Probably will stay with it until the 4.1. Really liked the new idea, since I could easily create default orders that would be then occasionally overwritten with a custom order. Ofc
prepend_order
would work the same but it would require a some changes in the app code and it's bit more risky. BTW either way I think that this change should be somehow highlighted - not all people read commits and/or changelogs, especially for minor "theoretically" bug fixing releases.609dae1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the feedback. We highlighted the change on the blog post and release emails http://weblog.rubyonrails.org/2013/10/17/Rails-4-0-1-rc1-has-been-released/
609dae1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rafaelfranca: I've got a feeling that after 4.0.1 release - you guys will have a real shitstorm about that :D - I will open a 🍺 and enjoy this one 💃
609dae1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hahahaha. Yes, that is expected. But it is better to regret soon than buy a mistake for long time.
609dae1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rafaelfranca : I will definitely enjoy this one :D can't wait till Tuesday. Thanks for help ;) keep up the good job but don't do things like that 2 often :D I don't like backporting stuff to Rails 3 or doing this type of monkey patches ;)