I've this models:
class Club < ActiveRecord::Base has_one :address, as: :addressable belongs_to :person accepts_nested_attributes_for :address end class Address < ActiveRecord::Base belongs_to :addressable, polymorphic: true end class Person < ActiveRecord::Base has_many :club has_one :address, as: :addressable end
Now I want to create/edit a club and either enter an adress for my club or select a person who represents the club address. Therefore I need a select field in my form to switch if the club will have his own address or use the address of the person. Depending on the selection the nested form or the person select box should be disabled and in addition NO relation to address from club should be created.