• D
    Add :accessible option to Associations for allowing mass assignments using... · e0750d6a
    David Dollar 提交于
    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: NPratik Naik <pratiknaik@gmail.com>
    e0750d6a
可在Tags中查看这些版本中当前仓库的状态.
CHANGELOG 287.3 KB