On Mar 30, 7:25 am, morbusg <[email protected]> wrote:
> Thanks for the quick reply. However, changing the schema thusly:
>
> class Foo < Sequel::Model
>   set_schema do
>     String :title, :primary_key => true, :text => true
>   end
>   create_table
>
>   one_to_many :bars
> end
>
> class Bar < Sequel::Model
>   set_schema do
>     String :name, :primary_key => true, :text => true
>     foreign_key :foo_title, :foos, :text => true
>   end
>   create_table
>
>   many_to_one :foo, :key => :foo_title, :text => true
> end
>
> Foo.insert(:title => 'Baz')
> Foo.first.bars.sql
>
> Still produces the following query: SELECT * FROM `bars` WHERE
> (`bars`.`foo_id` = 'Baz')

That's expected.  Just like you have to use :key=>:foo_title in
Bar.many_to_one :foo, you have to use :key=>:foo_title in
Foo.one_to_many :bars.

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.

Reply via email to