Update for ActiveRecord 4 API#5
Merged
nuclearsandwich merged 7 commits intotechnoweenie:masterfrom Mar 30, 2016
Merged
Conversation
This removes the use of ActiveRecord 3.x `all` with options and uses the specific query building methods followed by `ActiveRecord::Relation.to_a` instead. As far as I can tell, the tests do not test use fo a select or joins option so that stuff could be wrong.
It turns out, although this was documented there were no tests for it and it was never set by the initializer nor did it have any mutators. So out it goes.
Select probably was working pre-nuclearsandwich but inconsistencies in Ruby made it hard to see that. Restored that and wrote a very basic test for it.
This doesn't _really_ test the join option but off the top of my head I'm not sure what the best way to do so is. If there's a method that stops ActiveRecord from fetching association info from the database that would probably work but I don't know it. This at least test that specifying a join doesn't break anything else.
Collaborator
Author
|
/cc @mislav I dunno if you actually needed this anywhere but I'd love to get another pair of eyes reviewing these changes. also @lachlanhardy @lynnwallenstein for 👀 If there's nothing glaring here I'm probably going merge this and send another PR cutting ✂️ this as 2.0. |
test/helper.rb
Outdated
| end | ||
| end | ||
|
|
||
| puts AssociatedModel.table_name |
There was a problem hiding this comment.
What purpose does puts serve here?
Collaborator
Author
There was a problem hiding this comment.
What purpose does puts serve here?
None now that I've sussed model creation out 😁
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This removes the use of ActiveRecord 3.x
allwith options and uses the specific query building methods followed byActiveRecord::Relation.to_ainstead.As far as I can tell, the tests do not test use fo a select or joins option so that stuff could be wrong.
>= 4.0?:selectand:joinsoptions?cc #4