2009/4/30 Colin Law <[email protected]> > Use > has_one :wife
On second thoughts I am not sure about this, writing class Wife < ActiveRecord::Base belongs_to :husband end may well get you into serious trouble. > > This allows 0 or 1 wife unless your validations require that a wife exists > > See http://guides.rubyonrails.org/association_basics.html for an > explanation of the various associations. > > 2009/4/30 serenobs <[email protected]> > > >> Hi. >> On the document the has_many :limit option : >> The :limit option lets you restrict the total number of objects that >> will be fetched through an association. >> >> I'm a little confused about this explanation. >> is fetched means it can save more but restircted numbers to retrieve >> at once? >> >> For example, we can have wife/husband up to 1 (unless arab..) >> I suppose >> class Me < ActiveRecord::Base >> has_many :wife >> end >> because i can have a wife or not. so it is not 1:1, isn't it? >> but at the same time i want to limit the number of wife to just 1. >> how can i represent this relationship into active record? >> >> Thanks. >> >> >> >> >> > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

