I have a simple Client table (or model) where a Client can have a Parent Client (only one, or none). I modeled it this way:
class Client < ActiveRecord::Base
belongs_to :parent, :class_name => 'Client', :foreign_key => 'parent_id’
end
That seems to work fine. I have two questions:
- Is that the correct why to represent that relationship in an R3 model.
- What should the _form.html.erb look like? For example, I want a drop-down box listing all of the possible Clients (and None) as the Parent field.