On Jul 24, 8:09 pm, Scott LaBounty <[email protected]> wrote: > Given this code: > > << > require 'rubygems' > require 'sequel' > > DB = Sequel.sqlite # Create an in-memory database > > DB.create_table(:locations) do > primary_key :id > String :name > end > > DB.create_table(:copies) do > primary_key :id > Boolean :checked_out > foreign_key :location_id, :locations > end > > class Location < Sequel::Model > one_to_many :copies > end > > class Copy < Sequel::Model > many_to_one :locations many_to_one :location > end > > l = Location.create(:name => 'Here') > c = Copy.create(:checked_out => true) > l.add_copy(c) > puts "copy location = #{c.location.name}" > > > > Why do I get an "undefined method 'location' " in that last "puts"? I do > similar things in other code, so I must be missing something (again sigh > ...).
many_to_one takes a singular argument, not a plural. Jeremy --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sequel-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/sequel-talk?hl=en -~----------~----~----~----~------~----~------~--~---
