Hello, I have the following Sequel query:
* movies = Movie*
* .select(Sequel[:movies][:id], Sequel.function(:avg,
Sequel[:ratings][:value]))*
* .left_outer_join(:ratings, movie_id: :id)*
* .group_by(Sequel[:movies][:id])*
* .all*
The query works as expected but I have two problems:
1. I can't access the average movie rating with dot notation:
*results[2].avg*
*NoMethodError: undefined method `avg' for #<Movie
@values={:id=>"d1bfc20f-45e0-4b8a-bb5b-d97b920bd408", :avg=>0.35e1}>*
*from (pry):26:in `__pry__'*
*results[2][:avg] *- works as expected
2. How can I get all movie columns at once, *Sequel[:movies][:*] * does not
work.
Thanks in advance
Mat
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/sequel-talk/fbab787a-4fa7-4a11-96cd-7398de1b8043n%40googlegroups.com.