diff options
author | José Valim <jose.valim@gmail.com> | 2011-05-06 05:53:27 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-05-06 05:53:58 +0200 |
commit | 41a6d96c1bced4a2e4cba20b8c209c52656f59cf (patch) | |
tree | 1ca2561350a95bdbdc34bfcf6d15b06130c36af3 /activerecord | |
parent | 7adfd02b3f81bafe7272cdca59239fc24165eb2f (diff) | |
download | rails-41a6d96c1bced4a2e4cba20b8c209c52656f59cf.tar.gz rails-41a6d96c1bced4a2e4cba20b8c209c52656f59cf.tar.bz2 rails-41a6d96c1bced4a2e4cba20b8c209c52656f59cf.zip |
Update CHANGELOGs.
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/CHANGELOG | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index 9ff29f1155..a03751a6c1 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,5 +1,20 @@ *Rails 3.1.0 (unreleased)* +* AR#new, AR#create and AR#update_attributes all accept a second hash as option that allows you + to specify which role to consider when assigning attributes. This is built on top of ActiveModel's + new mass assignment capabilities: + + class Post < ActiveRecord::Base + attr_accessible :title + attr_accessible :title, :published_at, :as => :admin + end + + Post.new(params[:post], :as => :admin) + + assign_attributes() with similar API was also added and attributes=(params, guard) was deprecated. + + [Josh Kalderimis] + * default_scope can take a block, lambda, or any other object which responds to `call` for lazy evaluation: @@ -22,25 +37,7 @@ [Jon Leighton] -* Calling 'default_scope' multiple times in a class (including when a superclass calls - 'default_scope') is deprecated. The current behavior is that this will merge the default - scopes together: - - class Post < ActiveRecord::Base # Rails 3.1 - default_scope where(:published => true) - default_scope where(:hidden => false) - # The default scope is now: where(:published => true, :hidden => false) - end - - In Rails 3.2, the behavior will be changed to overwrite previous scopes: - - class Post < ActiveRecord::Base # Rails 3.2 - default_scope where(:published => true) - default_scope where(:hidden => false) - # The default scope is now: where(:hidden => false) - end - - If you wish to merge default scopes in special ways, it is recommended to define your default +* If you wish to merge default scopes in special ways, it is recommended to define your default scope as a class method and use the standard techniques for sharing code (inheritance, mixins, etc.): |