diff options
author | eileencodes <eileencodes@gmail.com> | 2014-08-30 07:59:40 -0400 |
---|---|---|
committer | eileencodes <eileencodes@gmail.com> | 2014-09-01 21:42:43 -0400 |
commit | 8e9e424fa99769b86c1d3df958ef534868543316 (patch) | |
tree | f260d5c62a443b938d43e5f0cd69f94642ad4563 /activerecord/lib/active_record/null_relation.rb | |
parent | 5c057f925516e87b2bcd6701fab42c1454652cc3 (diff) | |
download | rails-8e9e424fa99769b86c1d3df958ef534868543316.tar.gz rails-8e9e424fa99769b86c1d3df958ef534868543316.tar.bz2 rails-8e9e424fa99769b86c1d3df958ef534868543316.zip |
Break conditional branches into separate methods
This breaks the two branches of the `if reflection.last` and `else`
to clearer see where the two methods can be refactored. Eventually
we hope to remove the need for these separated methods altogether.
Move the first branch outside the loop
This code doesn't need to be in the loop because it it always affects
the last chain. `get_bind_values` and `add_constraints` must match
in this context because `get_bind_values` is the caching of `add_constraints`
Use each_cons to remove need for `chain[i + 1]`
The `chain[i + 1]` is confusing because it's not immediately obvious
what it's trying to achieve. The use of `each_cons` makes it clear
we need to get the `next_reflection`.
Diffstat (limited to 'activerecord/lib/active_record/null_relation.rb')
0 files changed, 0 insertions, 0 deletions