On May 2, 1:06 pm, "Victor 'Zverok' Shepelev" <[EMAIL PROTECTED]>
wrote:
> Faithfully, I think, that the most naturally will be to do.. well, the most
> natural thing:
>
> class D < Sequel::Model
> end
>
> class B < Sequel::Model
> end
>
> module A
>   class B < Sequel::Model
>   end
>
>   class C < Sequel::Model
>     belongs_to :b  #associates to A::B
>     has_many :ds   #associates to ::D
>   end
> end
>
> both cases of C's associations can be easily evaluated TO CLASS, VISIBLE
> WHEN ASSOCIATION IS DEFINED. It requires only one thing: early evaluation of
> "to what class association points".
>
> What do you think? If you are agree to my logic, I can think further for a
> "right" patch (OK, my initial patch was really naive).

Unfortunately, this would break the principal of least surprise for
the following code:

  module A
    class B < Sequel::Model
      has_many :cs   #associates to ::C, not A::C
    end

    class C < Sequel::Model
      belongs_to :b  #associates to A::B
    end
  end

However, if you can make the following work, I'll consider applying
the patch:

  module A
    class B < Sequel::Model
      has_many :cs   #associates to A::C
      belongs_to :c, :class=>"::C" # associates to ::C
      belongs_to :b, :class=>"B" # associates to A::B
    end

    class C < Sequel::Model
      belongs_to :b  #associates to A::B
      has_many :bs, :class=>"::B", # associates to ::B
      has_many :cs, :class=>"C", # associates to A::C
    end
  end

  class B < Sequel::Model
  end

  class C < Sequel::Model
  end

Jeremy
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to sequel-talk@googlegroups.com
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