= ripple-anaf This is inspired and similar implementation to the `accepts_nested_attributes` functionality found in AR. This allows the use update attributes and create new child records through the parent. It also allows the use of the `fields_for` form view helper, using a presenter pattern. To enable in the model, call the class method, using the same relationship as defined in the `one` or `many`. class Shipment include Ripple::Document property :identifier, String one :box many :addresses many :checkpoints accepts_nested_attributes_for :box, :addresses accepts_nested_attributes_for :checkpoints, :allow_destroy => true, :reject_if => proc{|attrs| attrs['signed_off'].blank? } end Now, you can do things like this: Shipment.create( :identifier => '1Z0001', :box_attributes => { :weight => 1.4 }, :addresses_attributes => [ { :street => "Main Street" } ] ) And in your views you can use fields_for: <%= form_for(@shipment) do |f| %> <%= f.text_field :identifier %> <%= f.fields_for :box do |ff| %> <%= ff.text_field :weight %> <% end %> <% end %> == Supported Features * Same DSL for linked and embedded documents (except embedded many) * :reject_if * :allow_destroy * :update_only (soon) == Note on Patches/Pull Requests * Fork the project. * Make your feature addition or bug fix. * Add tests for it. This is important so I don't break it in a future version unintentionally. * Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull) * Send me a pull request. Bonus points for topic branches. == Copyright Copyright (c) 2010 Brian Kaney. See LICENSE for details.