Displaying 1 result from an estimated 1 matches for "laboratoriescontrol".
2008 Feb 28
2
REST nested routes with has_one
Hi everyone,
I have 2 models:
class User < ActiveRecord::Base
has_one :laboratory, :foreign_key => "pi_id"
end
class Laboratory < ActiveRecord::Base
belongs_to :pi, :class_name => "User", :foreign_key => "pi_id"
end
I set the following routes (in routes.rb):
map.resources :laboratories
map.resources :users, :has_one => :laboratory
All the