diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-09-18 19:27:00 -0700 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-09-18 19:27:00 -0700 |
commit | 731d8095355225a9777922c92b453b0c9c7e8e03 (patch) | |
tree | 009c1f0fa0c25e9a0cfd43377eecec2ac87ab7b2 /activerecord | |
parent | 2dff5dc5cbcefcb3d8f8e73d1f6a2c2f0cdbf711 (diff) | |
parent | 533c11417acd63aeb36b411b8ac0cfa5cb574ab6 (diff) | |
download | rails-731d8095355225a9777922c92b453b0c9c7e8e03.tar.gz rails-731d8095355225a9777922c92b453b0c9c7e8e03.tar.bz2 rails-731d8095355225a9777922c92b453b0c9c7e8e03.zip |
Merge pull request #7694 from guilleiguaran/update-ar-docs
Update AR docs to remove reference to mass assignment options
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/core.rb | 11 | ||||
-rw-r--r-- | activerecord/lib/active_record/persistence.rb | 11 |
2 files changed, 1 insertions, 21 deletions
diff --git a/activerecord/lib/active_record/core.rb b/activerecord/lib/active_record/core.rb index 8f798830d4..f97c363871 100644 --- a/activerecord/lib/active_record/core.rb +++ b/activerecord/lib/active_record/core.rb @@ -160,18 +160,9 @@ module ActiveRecord # In both instances, valid attribute keys are determined by the column names of the associated table -- # hence you can't have attributes that aren't part of the table columns. # - # +initialize+ respects mass-assignment security and accepts either +:as+ or +:without_protection+ options - # in the +options+ parameter. - # - # ==== Examples + # ==== Example: # # Instantiates a single new object # User.new(:first_name => 'Jamie') - # - # # Instantiates a single new object using the :admin mass-assignment security role - # User.new({ :first_name => 'Jamie', :is_admin => true }, :as => :admin) - # - # # Instantiates a single new object bypassing mass-assignment security - # User.new({ :first_name => 'Jamie', :is_admin => true }, :without_protection => true) def initialize(attributes = nil) defaults = self.class.column_defaults.dup defaults.each { |k, v| defaults[k] = v.dup if v.duplicable? } diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb index 6f38262b86..2eaad1d469 100644 --- a/activerecord/lib/active_record/persistence.rb +++ b/activerecord/lib/active_record/persistence.rb @@ -17,12 +17,6 @@ module ActiveRecord # # Create a single new object # User.create(:first_name => 'Jamie') # - # # Create a single new object using the :admin mass-assignment security role - # User.create({ :first_name => 'Jamie', :is_admin => true }, :as => :admin) - # - # # Create a single new object bypassing mass-assignment security - # User.create({ :first_name => 'Jamie', :is_admin => true }, :without_protection => true) - # # # Create an Array of new objects # User.create([{ :first_name => 'Jamie' }, { :first_name => 'Jeremy' }]) # @@ -183,11 +177,6 @@ module ActiveRecord # Updates the attributes of the model from the passed-in hash and saves the # record, all wrapped in a transaction. If the object is invalid, the saving # will fail and false will be returned. - # - # When updating model attributes, mass-assignment security protection is respected. - # If no +:as+ option is supplied then the +:default+ role will be used. - # If you want to bypass the forbidden attributes protection then you can do so using - # the +:without_protection+ option. def update_attributes(attributes) # The following transaction covers any possible database side-effects of the # attributes assignment. For example, setting the IDs of a child collection. |