On Mar 22, 2:45 pm, Nels Nelson <[email protected]> wrote:
> On Mar 21, 4:13 pm, elskwid <[email protected]> wrote:
>
> > You mention 'least surprise' but I would contend that modifying Sequel
> > in such a way is more surprising than having some Ruby code that any
> > rubyist would be able to understand.
>
> Hi Don, forum,
> I hate to keep harping on this, but I've been mulling over what you
> said.  That is, that modifying Sequel in such a way is more surprising
> than having some Ruby code that any rubyist would be able to
> understand.
>
> Would it be such a troubling thing if Sequel could optionally disable
> implicit dataset assignments?  It would be a matter of specifying the
> option when defining a model.
>
> Surely the following example is naive, but here it is:
>
> base.rb.diff  :https://gist.github.com/882106
> model.rb.diff :https://gist.github.com/882096
>
> Now, one could define models in this manner :https://gist.github.com/882096
>
> Just an idea.  :-\

If you really must do this, you don't actually need to modify Sequel.
Instead of:

  class Foo < Sequel::Model
  end

do:

  Foo = Class.new(Sequel::Model)
  class Foo
  end

Problem solved.  Just make sure you call Foo.set_dataset before
attempting to use Foo.  It's quite possible you'll have problems if
you do this.  For example, if your primary key isn't "id" and you try
to create associations.  I think you've been given enough warnings.
You might as well try to do what you originally wanted to do anyway
(using this code), and see what happens.

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