提交 4d31ee1e 编写于 作者: A Aaron Patterson

removing unused variables

上级 e83d1537
...@@ -16,7 +16,7 @@ def construct_find_scope ...@@ -16,7 +16,7 @@ def construct_find_scope
:readonly => @reflection.options[:readonly] :readonly => @reflection.options[:readonly]
} }
end end
def construct_create_scope def construct_create_scope
construct_owner_attributes(@reflection) construct_owner_attributes(@reflection)
end end
...@@ -51,7 +51,7 @@ def construct_from ...@@ -51,7 +51,7 @@ def construct_from
def construct_select(custom_select = nil) def construct_select(custom_select = nil)
distinct = "DISTINCT " if @reflection.options[:uniq] distinct = "DISTINCT " if @reflection.options[:uniq]
selected = custom_select || @reflection.options[:select] || "#{distinct}#{@reflection.quoted_table_name}.*" custom_select || @reflection.options[:select] || "#{distinct}#{@reflection.quoted_table_name}.*"
end end
def construct_joins(custom_joins = nil) def construct_joins(custom_joins = nil)
......
...@@ -67,8 +67,7 @@ def test_create_from_association_should_respect_default_scope ...@@ -67,8 +67,7 @@ def test_create_from_association_should_respect_default_scope
end end
def test_no_sql_should_be_fired_if_association_already_loaded def test_no_sql_should_be_fired_if_association_already_loaded
car = Car.create(:name => 'honda') Car.create(:name => 'honda')
bulb = car.bulbs.create
bulbs = Car.first.bulbs bulbs = Car.first.bulbs
bulbs.inspect # to load all instances of bulbs bulbs.inspect # to load all instances of bulbs
assert_no_queries do assert_no_queries do
......
...@@ -354,7 +354,6 @@ def test_association_proxy_transaction_method_starts_transaction_in_association_ ...@@ -354,7 +354,6 @@ def test_association_proxy_transaction_method_starts_transaction_in_association_
end end
def test_has_many_association_through_a_belongs_to_association_where_the_association_doesnt_exist def test_has_many_association_through_a_belongs_to_association_where_the_association_doesnt_exist
author = authors(:mary)
post = Post.create!(:title => "TITLE", :body => "BODY") post = Post.create!(:title => "TITLE", :body => "BODY")
assert_equal [], post.author_favorites assert_equal [], post.author_favorites
end end
......
...@@ -163,7 +163,6 @@ def test_exclusive_dependence ...@@ -163,7 +163,6 @@ def test_exclusive_dependence
firm = ExclusivelyDependentFirm.find(9) firm = ExclusivelyDependentFirm.find(9)
assert_not_nil firm.account assert_not_nil firm.account
account_id = firm.account.id
assert_equal [], Account.destroyed_account_ids[firm.id] assert_equal [], Account.destroyed_account_ids[firm.id]
firm.destroy firm.destroy
...@@ -180,7 +179,7 @@ def test_dependence_with_nil_associate ...@@ -180,7 +179,7 @@ def test_dependence_with_nil_associate
def test_dependence_with_restrict def test_dependence_with_restrict
firm = RestrictedFirm.new(:name => 'restrict') firm = RestrictedFirm.new(:name => 'restrict')
firm.save! firm.save!
account = firm.create_account(:credit_limit => 10) firm.create_account(:credit_limit => 10)
assert_not_nil firm.account assert_not_nil firm.account
assert_raise(ActiveRecord::DeleteRestrictionError) { firm.destroy } assert_raise(ActiveRecord::DeleteRestrictionError) { firm.destroy }
end end
...@@ -197,8 +196,8 @@ def test_successful_build_association ...@@ -197,8 +196,8 @@ def test_successful_build_association
def test_build_association_twice_without_saving_affects_nothing def test_build_association_twice_without_saving_affects_nothing
count_of_account = Account.count count_of_account = Account.count
firm = Firm.find(:first) firm = Firm.find(:first)
account1 = firm.build_account("credit_limit" => 1000) firm.build_account("credit_limit" => 1000)
account2 = firm.build_account("credit_limit" => 2000) firm.build_account("credit_limit" => 2000)
assert_equal count_of_account, Account.count assert_equal count_of_account, Account.count
end end
......
...@@ -484,7 +484,6 @@ def test_eager_loaded_child_instance_should_be_shared_with_parent_on_find ...@@ -484,7 +484,6 @@ def test_eager_loaded_child_instance_should_be_shared_with_parent_on_find
def test_child_instance_should_be_shared_with_replaced_via_accessor_parent def test_child_instance_should_be_shared_with_replaced_via_accessor_parent
face = faces(:confused) face = faces(:confused)
old_man = face.polymorphic_man
new_man = Man.new new_man = Man.new
assert_not_nil face.polymorphic_man assert_not_nil face.polymorphic_man
...@@ -499,7 +498,6 @@ def test_child_instance_should_be_shared_with_replaced_via_accessor_parent ...@@ -499,7 +498,6 @@ def test_child_instance_should_be_shared_with_replaced_via_accessor_parent
def test_child_instance_should_be_shared_with_replaced_via_method_parent def test_child_instance_should_be_shared_with_replaced_via_method_parent
face = faces(:confused) face = faces(:confused)
old_man = face.polymorphic_man
new_man = Man.new new_man = Man.new
assert_not_nil face.polymorphic_man assert_not_nil face.polymorphic_man
......
...@@ -642,7 +642,7 @@ def test_preload_polymorph_many_types ...@@ -642,7 +642,7 @@ def test_preload_polymorph_many_types
def test_preload_nil_polymorphic_belongs_to def test_preload_nil_polymorphic_belongs_to
assert_nothing_raised do assert_nothing_raised do
taggings = Tagging.find(:all, :include => :taggable, :conditions => ['taggable_type IS NULL']) Tagging.find(:all, :include => :taggable, :conditions => ['taggable_type IS NULL'])
end end
end end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册