I will try to look into this issues (with
dm-accepts_nested_attributes) and see if I can come up with a fix
soon. However, I'm currently rather busy. Of course I'd be glad to
accept patches!

cheers
snusnu

On Mon, Nov 23, 2009 at 02:42, trung <[email protected]> wrote:
> I've been using this plugin and I rant into two very big bugs.
>
> 1. If the child model fails validation, the parent.new_record? method
> still return true. It should be false.
>
> 2. If the child model fails validation, the parent after save and
> after create callback still run. Parent's callback should halt.
>
> Thank you.
>
> On Nov 17, 4:03 am, Martin Gamsjaeger <[email protected]> wrote:
>> George,
>>
>> You may want to givehttp://github.com/snusnu/dm-accepts_nested_attributesa 
>> try. It should
>> take care of the DM side of things. I'm not entirely sure how merb's
>> #field_for plays with it atm, but I'd be glad to work with you (and
>> accept patches :) to make merb(-helpers) and dana (short for
>> dm-accepts_nested_attributes) play together nicely.
>>
>> cheers
>> snusnu
>>
>>
>>
>> On Tue, Nov 17, 2009 at 11:10, George <[email protected]> 
>> wrote:
>> > If a Client model has-n addresses, what's the best way to handle these
>> > on a form?
>>
>> > class Client
>> >  ...
>> >  has n, :client_addresses
>> >  has n, :addresses, :through => :client_addresses
>> >  ...
>> > end
>>
>> > In a Client edit form we have something like this:
>> > <% client.addresses.each do |address| %>
>> > <div>
>> >  <%= fields_for address do %>
>> >    <%= text_field :address1, :label=>"Number/name" %>
>> >    <%= text_field :address2, :label=>"Locality" %>
>> >    ...etc...
>> >  <% end =%>
>> > </div>
>> > <% end %>
>>
>> > That renders each html address field with names like "address
>> > [address1]" so I would expect the server side to receive those as
>> > arrays of 0-or-more values. Looking at the output it seems that merb
>> > only sees one value for each field.
>> > Is this the right approach? How should we handle the submitted address
>> > fields server side?
>> > I suppose I could parse the params object manually but that is not
>> > very reusable.
>>
>> > Many thanks
>> > George
>>
>> > --
>>
>> > You received this message because you are subscribed to the Google Groups 
>> > "DataMapper" group.
>> > To post to this group, send email to [email protected].
>> > For more options, visit this group 
>> > athttp://groups.google.com/group/datamapper?hl=.
>
> --
>
> You received this message because you are subscribed to the Google Groups 
> "DataMapper" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/datamapper?hl=.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=.


Reply via email to