I have the following:

<<
require 'rubygems'
require 'sequel'

DB = Sequel.sqlite # Create an in-memory database

DB.create_table(:users) do
    primary_key :id
    String :user_name
    foreign_key :question_id, :questions
end

DB.create_table(:questions) do
    primary_key :id
    String :question
end

class User < Sequel::Model
    many_to_one :question
end

class Question < Sequel::Model
    one_to_many :users
end

u = User.create(:user_name => 'slabounty')
q = Question.create(:question => 'Where?')
#u.add_question(q)
q.add_user(u)

puts "question = #{u.question.question}"
>>

Why is it that what I have works, but I can't do the opposite (i.e. the
u.add_question(q) commented line)?

I'm trying to implement a "forgot password" function and while I suppose
that I can do it either way, the second seems more "natural" (for some value
of natural).

Thanks,

-- 
Scott
http://steamcode.blogspot.com/

--~--~---------~--~----~------------~-------~--~----~
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