I've been trying to use the :select option on an association to add in some 
fields from a join table, but it was giving me an error with the :select (not 
without).

The example from the docs:

    User.many_to_many  :films,
                       :left_key   =>  :user_id,
                       :right_key  =>  :film_id,
                       :join_table =>  :users_rel_films,
                       :select     =>  [ Sequel.expr(:films).*,
                                         :users_rel_films__no_of_views,
                                         :users_rel_films__demand],
                       :class      =>  :"App::Film"

> Error: ArgumentError: wrong number of arguments (0 for 1)

So I tried a few things in the console:

    Sequel.expr(:films).* # according to the docs this should return "films".*

> ArgumentError: wrong number of arguments (0 for 1)

In case it's something to do with that table, I tried:

    Sequel.expr(:schema_info).*

> ArgumentError: wrong number of arguments (0 for 1)

but this works:

    Sequel.expr(:schema_info).* 2

> => #<Sequel::SQL::NumericExpression @op=>:, args=>[#<Sequel::SQL::Wrapper 
> @value=>:schema_info, 2]

This is ok too:

    Sequel.expr(:schema_info)

> => #<Sequel::SQL::Wrapper @value=>:schema_info

I've tried a few other things but they all give either the same error or syntax 
errors.

The sequel version is 3.36.1

I'm sure I must be doing something silly, but I can't work out what. Any help 
with this is much appreciated.


Regards,
Iain

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