Skip to content
This repository
Browse code

Resolve some TODO comments which I decided did not need anything done

  • Loading branch information...
commit 02a43f9f4585d3c932e12b60ef23543f9c534a2e 1 parent 39a6f4f
Jon Leighton jonleighton authored
2  activerecord/lib/active_record/associations/alias_tracker.rb
@@ -16,7 +16,7 @@ def initialize(table_joins = [])
16 16 def aliased_table_for(table_name, aliased_name = nil)
17 17 table_alias = aliased_name_for(table_name, aliased_name)
18 18
19   - if table_alias == table_name # TODO: Is this conditional necessary?
  19 + if table_alias == table_name
20 20 Arel::Table.new(table_name)
21 21 else
22 22 Arel::Table.new(table_name).alias(table_alias)
11 activerecord/lib/active_record/associations/through_association.rb
@@ -9,12 +9,8 @@ module ThroughAssociation #:nodoc:
9 9
10 10 # We merge in these scopes for two reasons:
11 11 #
12   - # 1. To get the scope_for_create on through reflection when building associated objects
13   - # 2. To get the type conditions for any STI classes in the chain
14   - #
15   - # TODO: Don't actually do this. Getting the creation attributes for a non-nested through
16   - # is a special case. The rest (STI conditions) should be handled by the reflection
17   - # itself.
  12 + # 1. To get the default_scope conditions for any of the other reflections in the chain
  13 + # 2. To get the type conditions for any STI models in the chain
18 14 def target_scope
19 15 scope = super
20 16 chain[1..-1].each do |reflection|
@@ -61,7 +57,8 @@ def construct_join_attributes(*records)
61 57 end
62 58 end
63 59
64   - # TODO: Think about this in the context of nested associations
  60 + # Note: this does not capture all cases, for example it would be crazy to try to
  61 + # properly support stale-checking for nested associations.
65 62 def stale_state
66 63 if through_reflection.macro == :belongs_to
67 64 owner[through_reflection.foreign_key].to_s
1  activerecord/lib/active_record/relation/query_methods.rb
@@ -260,7 +260,6 @@ def build_joins(manager, joins)
260 260 join_list
261 261 )
262 262
263   - # TODO: Necessary?
264 263 join_nodes.each do |join|
265 264 join_dependency.alias_tracker.aliased_name_for(join.left.name.downcase)
266 265 end

0 comments on commit 02a43f9

Please sign in to comment.
Something went wrong with that request. Please try again.