You're looking for the :dependent => :destroy option to has_many, I believe. That's part of Rails, not Hobo.

Bryan

François Beausoleil wrote:
Hi all!

I have an employee model like this:

class Employee < ActiveRecord::Base
  hobo_model
  fields do
    timestamps
  end

  belongs_to :company
  belongs_to :person

  validates_uniqueness_of :person_id, :scope => :company_id
end

I'm on a Person page, where I have the has-many editor:

<extend tag="form" for="Person">
  <old-form merge>
    <field-list: fields="name, employees">
      <employees-view:>
        <input-many>
          <field-list fields="company"/>
        </input-many>
      </employees-view:>
    </field-list:>
  </old-form>
</extend>

UI-wise, things work out: I can add / remove employee records.  I'd
like the association record to be destroyed when I unlink the employee
from the person.  How does that work?

I read the source code, to see how it was implemented.  I can't seem
to find it at all:
http://github.com/tablatom/hobo/blob/master/hobo/lib/hobo/accessible_associations.rb#L109

Thanks!
François


--
You received this message because you are subscribed to the Google Groups "Hobo 
Users" 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/hobousers?hl=en.

Reply via email to