1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activerecord/test
David Dollar e0750d6a5c 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>
2008-07-14 02:53:21 +01:00
..
assets move assets and models 2008-01-18 07:27:03 +00:00
cases Add :accessible option to Associations for allowing mass assignments using hash. [#474 state:resolved] 2008-07-14 02:53:21 +01:00
connections revert mysql test credential change 2008-05-31 17:07:44 -07:00
fixtures Add has_many :primary_key option to allow setting the primary key on a has many association 2008-07-06 20:25:10 +02:00
migrations Added protection against duplicate migration names (Aslak Hellesøy) [#112 state:resolved] 2008-05-11 13:37:29 -05:00
models Add :accessible option to Associations for allowing mass assignments using hash. [#474 state:resolved] 2008-07-14 02:53:21 +01:00
schema Add has_many :primary_key option to allow setting the primary key on a has many association 2008-07-06 20:25:10 +02:00
config.rb Merge branch 'ar-test-cleanup' of git://git.geeksomnia.com/rails 2008-01-21 17:20:51 +00:00