I think I've just thoroughly confused myself at this point. I have a
class that has a has_many and has_one relationship that use the same
object.
Here is an example:
class Person < ActiveRecord::Base
has_many :hobbies
has_one :favorite_hobby, :class_name => "Hobby"
end
class Hobby < ActiveRecord::Base
belongs_to :person
belongs_to :person, :foreign_key => "favorite_hobby_id"
end
Of course, this doesn't work. Any ideas what I need to change to get
this to work properly?
Thanks.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---