You can access the model's dataset via modelname_dataset. For example:
User.first.contacts_dataset.filter(:name =>/abc/). I'm pretty new to
Sequel, so I don't know if there's a better way of doing what you ask.

-- Doug

On Jun 21, 4:40 pm, François Beausoleil
<[email protected]> wrote:
> Hi!
>
> I have this:
>
> class User < Sequel::Model(:users)
>   one_to_many :contacts
> end
>
> class Contact < Sequel::Model(:contacts)
> end
>
> Calling User.first.contacts.filter(:name => /abc/) raises a
> NoMethodError:
>
> NoMethodError: undefined method `filter' for #<Array:0x00000103660c48>
>         from (irb):4
>         from /Users/francois/.rvm/gems/ruby-1.9.2-p180@meetphil/bundler/gems/
> rails-391b3739864c/railties/lib/rails/commands/console.rb:45:in
> `start'
>         from /Users/francois/.rvm/gems/ruby-1.9.2-p180@meetphil/bundler/gems/
> rails-391b3739864c/railties/lib/rails/commands/console.rb:8:in `start'
>         from /Users/francois/.rvm/gems/ruby-1.9.2-p180@meetphil/bundler/gems/
> rails-391b3739864c/railties/lib/rails/commands.rb:40:in `<top
> (required)>'
>         from script/rails:6:in `require'
>         from script/rails:6:in `<main>'
>
> There must be a good reason for associations to not return datasets.
> Is there any way to get a dataset instead of a collection?
>
> I'm working on a multi-tenant database, and I would really like to be
> able to continue filtering after going through the current user for
> the contacts available to them.
>
> Thanks!
> François Beausoleilhttp://github.com/francois

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