How would you render and handle the :is_active radio_buttons for one
Client based on these models:

class Client
  ...
  has n, :client_addresses
  has n, :addresses, :through => :client_addresses
  accepts_nested_attributes_for :addresses
  accepts_nested_attributes_for :client_addresses
end

class ClientAddress
  ...
  property :is_active, Boolean
  belongs_to :client
  belongs_to :address
end

class Address
  ...
  has n, :client_addresses
  has n, :clients, :through => :client_addresses
end

Using susnu's excellent nested attributes plugin (http://github.com/
snusnu/dm-accepts_nested_attributes) I can add and edit any number of
addresses for a client ok, but
what is the best way to show a radio button next to each address for
the "is_active" selection?
(A client can have multiple addresses but only one can be active)

What should the radio buttons' name look like?
Is the ClientAddress model the best place to be storing this flag or
should I use an active_address_id field in the Client instead?

Many thanks,
George
-- 
You received this message because you are subscribed to the Google Groups 
"merb" 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/merb?hl=en.


Reply via email to