aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionpack/lib/action_controller/metal/strong_parameters.rb1
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb10
-rw-r--r--activerecord/test/cases/migration/references_statements_test.rb4
-rw-r--r--activerecord/test/cases/nested_attributes_test.rb10
4 files changed, 12 insertions, 13 deletions
diff --git a/actionpack/lib/action_controller/metal/strong_parameters.rb b/actionpack/lib/action_controller/metal/strong_parameters.rb
index 04dc1d37f7..bd0bcd23ff 100644
--- a/actionpack/lib/action_controller/metal/strong_parameters.rb
+++ b/actionpack/lib/action_controller/metal/strong_parameters.rb
@@ -65,7 +65,6 @@ module ActionController
# params["key"] # => "value"
class Parameters < ActiveSupport::HashWithIndifferentAccess
cattr_accessor :permit_all_parameters, instance_accessor: false
- attr_accessor :permitted # :nodoc:
# Returns a new instance of <tt>ActionController::Parameters</tt>.
# Also, sets the +permitted+ attribute to the default value of
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
index 73aaffc146..17dd71e898 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
@@ -629,11 +629,13 @@ module ActiveRecord
index_options = options[:where] ? " WHERE #{options[:where]}" : ""
end
else
- message = "Passing a string as third argument of `add_index` is deprecated and will" +
- " be removed in Rails 4.1." +
- " Use add_index(#{table_name.inspect}, #{column_name.inspect}, unique: true) instead"
+ if options
+ message = "Passing a string as third argument of `add_index` is deprecated and will" +
+ " be removed in Rails 4.1." +
+ " Use add_index(#{table_name.inspect}, #{column_name.inspect}, unique: true) instead"
- ActiveSupport::Deprecation.warn message
+ ActiveSupport::Deprecation.warn message
+ end
index_type = options
end
diff --git a/activerecord/test/cases/migration/references_statements_test.rb b/activerecord/test/cases/migration/references_statements_test.rb
index 144302bd4a..d8a6565d54 100644
--- a/activerecord/test/cases/migration/references_statements_test.rb
+++ b/activerecord/test/cases/migration/references_statements_test.rb
@@ -64,7 +64,7 @@ module ActiveRecord
remove_reference table_name, :supplier
refute index_exists?(table_name, :supplier_id)
end
-
+
def test_does_not_delete_reference_type_column
with_polymorphic_column do
remove_reference table_name, :supplier
@@ -73,7 +73,7 @@ module ActiveRecord
assert column_exists?(table_name, :supplier_type, :string)
end
end
-
+
def test_deletes_reference_type_column
with_polymorphic_column do
remove_reference table_name, :supplier, polymorphic: true
diff --git a/activerecord/test/cases/nested_attributes_test.rb b/activerecord/test/cases/nested_attributes_test.rb
index fe9eddbdec..9674f2ce94 100644
--- a/activerecord/test/cases/nested_attributes_test.rb
+++ b/activerecord/test/cases/nested_attributes_test.rb
@@ -464,17 +464,15 @@ class TestNestedAttributesOnABelongsToAssociation < ActiveRecord::TestCase
end
def test_should_unset_association_when_an_existing_record_is_destroyed
- @ship.reload
original_pirate_id = @ship.pirate.id
- @ship.attributes = {:pirate_attributes => {:id => @ship.pirate.id, :_destroy => true}}
- @ship.save!
+ @ship.update_attributes! pirate_attributes: { id: @ship.pirate.id, _destroy: true }
- assert_empty Pirate.where(["id = ?", original_pirate_id])
+ assert_empty Pirate.where(id: original_pirate_id)
assert_nil @ship.pirate_id
assert_nil @ship.pirate
@ship.reload
- assert_empty Pirate.where(["id = ?", original_pirate_id])
+ assert_empty Pirate.where(id: original_pirate_id)
assert_nil @ship.pirate_id
assert_nil @ship.pirate
end
@@ -491,7 +489,7 @@ class TestNestedAttributesOnABelongsToAssociation < ActiveRecord::TestCase
@ship.update_attributes(:pirate_attributes => { :id => @ship.pirate.id, :_destroy => '1' })
assert_nothing_raised(ActiveRecord::RecordNotFound) { @ship.pirate.reload }
-
+ ensure
Ship.accepts_nested_attributes_for :pirate, :allow_destroy => true, :reject_if => proc { |attributes| attributes.empty? }
end