That's not a great case for the has_one association because as you pointed out, the real world usage probably isn't there.
Here's a couple for you
class Student < ActiveRecord::Base
# so in here, there's an id, name for the student and any other details they may have
has_one :locker
end
class Locker < ActiveRecord::Base
# here you have the fields id, locker_number, student_id (this is the one for the association)
belongs_to :student
end
---
class Sale < ActiveRecord::Base
# id and whatever other fields
has_one :invoice
end
class Invoice < ActiveRecord::Base
# id, sale_id, any other fields you want
belongs_to :sale
end
Do they help at all?
Matt Didcoe
mat...@gmail.com