diff options
author | David Dollar <ddollar@gmail.com> | 2008-07-13 21:13:50 -0400 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2008-07-14 02:53:21 +0100 |
commit | e0750d6a5c7f621e4ca12205137c0b135cab444a (patch) | |
tree | 442e795385f4114b8270e9d5d325b307bbb1bc13 /activerecord/CHANGELOG | |
parent | c6f397c5cecf183680c191dd2128c0a96c5b9399 (diff) | |
download | rails-e0750d6a5c7f621e4ca12205137c0b135cab444a.tar.gz rails-e0750d6a5c7f621e4ca12205137c0b135cab444a.tar.bz2 rails-e0750d6a5c7f621e4ca12205137c0b135cab444a.zip |
Add :accessible option to Associations for allowing mass assignments using hash. [#474 state:resolved]
Allows nested Hashes (i.e. from nested forms) to hydrate the appropriate
ActiveRecord models.
class Post < ActiveRecord::Base
belongs_to :author, :accessible => true
has_many :comments, :accessible => true
end
post = Post.create({
:title => 'Accessible Attributes',
:author => { :name => 'David Dollar' },
:comments => [
{ :body => 'First Post!' },
{ :body => 'Nested Hashes are great!' }
]
})
post.comments << { :body => 'Another Comment' }
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'activerecord/CHANGELOG')
-rw-r--r-- | activerecord/CHANGELOG | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index d92b89cfe0..56b1781537 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,5 +1,23 @@ *Edge* +* Add :accessible option to associations for allowing (opt-in) mass assignment. #474. [David Dollar] Example : + + class Post < ActiveRecord::Base + belongs_to :author, :accessible => true + has_many :comments, :accessible => true + end + + post = Post.create({ + :title => 'Accessible Attributes', + :author => { :name => 'David Dollar' }, + :comments => [ + { :body => 'First Post!' }, + { :body => 'Nested Hashes are great!' } + ] + }) + + post.comments << { :body => 'Another Comment' } + * Add :tokenizer option to validates_length_of to specify how to split up the attribute string. #507. [David Lowenfels] Example : # Ensure essay contains at least 100 words. |