Skip to content

Instantly share code, notes, and snippets.

@ryanbriones
Forked from jonhoman/gist:750977
Created December 22, 2010 05:15
Show Gist options
  • Save ryanbriones/751123 to your computer and use it in GitHub Desktop.
Save ryanbriones/751123 to your computer and use it in GitHub Desktop.
class Company < ActiveRecord::Base
has_many :employees
end
class Employee < ActiveRecord::Base
has_one :position
belongs_to :company
end
class Position < ActiveRecord::Base
belongs_to :employee
end
=======================================
# time to build mulit-model form
company.employees << Employee.new
employee.position = Position.new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment