I have 2 models:
class User < ActiveRecord::Base
has_one :laboratory, :foreign_key => "pi_id"
class Laboratory < ActiveRecord::Base
belongs_to :pi, :class_name => "User", :foreign_key => "pi_id"
I set the following routes (in routes.rb):
map.resources :users, :has_one => :laboratory
All the routes are generated as expected, as demonstrated by rake
routes. In particular:
user_laboratory GET /users/:user_id/laboratory
But if I try users/17/laboratory, I get a 'Couldn't find Laboratory
without an ID' error. Someone could help me with this?
In advance thank you very much.