Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 2 contributors
Commits on Jan 16, 2013
@carlosantoniodasilva carlosantoniodasilva Merge pull request #10 from asanghi/master
Fix Deprecations on use of assert_blank?
516faf0
@asanghi add all_blank proc bf5a422
View
3  lib/active_record/mass_assignment_security/nested_attributes.rb
@@ -4,6 +4,9 @@ module NestedAttributes
extend ActiveSupport::Concern
module ClassMethods
+
+ REJECT_ALL_BLANK_PROC = proc { |attributes| attributes.all? { |key, value| key == '_destroy' || value.blank? } }
+
def accepts_nested_attributes_for(*attr_names)
options = { :allow_destroy => false, :update_only => false }
options.update(attr_names.extract_options!)
View
2  test/models/person.rb
@@ -70,7 +70,7 @@ class NestedPerson < ActiveRecord::Base
attr_accessible :best_friend_attributes, :best_friend_first_name, :as => :admin
has_one :best_friend, :class_name => 'NestedPerson', :foreign_key => :best_friend_id
- accepts_nested_attributes_for :best_friend, :update_only => true
+ accepts_nested_attributes_for :best_friend, :update_only => true, :reject_if => :all_blank
def comments=(new_comments)
raise RuntimeError

No commit comments for this range

Something went wrong with that request. Please try again.