<    June 2018     >
Su Mo Tu We Th Fr Sa  
                1  2  
 3  4  5  6  7  8  9  
10 11 12 13 14 15 16  
17 18 19 20 21 22 _2_3  
24 25 26 27 28 29 30
00:03 <quintasan> I must be going senile. How would I go around creating a hash with groups in Sequel? My table has country:string column and what I want to get is { :poland => <all records where country = "POLAND"> }
00:19 <lopex> quintasan: hello from poland
00:24 <jeremyevans> quintasan: to_hash_groups(:country)
00:24 <jeremyevans> quintasan: keys will be strings and not symbols, hopefully that doesn't matter to you
00:40 <quintasan> kek
00:41 <quintasan> jeremyevans: Thanks
07:01 kspencer_ joined
07:13 kspencer_ joined
07:15 claudiuinberlin joined
08:23 claudiuinberlin joined
09:58 arne joined
10:23 arne joined
11:45 arne joined
13:09 pdrakeweb joined
13:11 pdrakewe_ joined
14:20 <quintasan> jeremyevans: I'm probably doing something wrong but I have two records - Anime and Studio and a join table for them, Anime has 5031 entries Anime.where(year: 2010).join(:studios).count gives me 1029832 which sounds very wrong.
14:36 <quintasan> Alright what the hell
14:38 <Caesium> sounds like you're joining every row in Anime to every row in Studio :)
14:38 <Caesium> you need a join condition
14:40 <quintasan> Caesium: Any idea how to specify that when I have an join_table?
14:40 <Caesium> the second arg to join, as a hash usually
14:41 <Caesium> .join(:studios, Sequel.qualify(:anime, :id) => :studio_id) or something like that, iirc
14:41 <Caesium> I don't tend to use joins that much, I prefer declaring associations (like one_to_many) and then using those
14:41 <Caesium> that then handles the conditions for you
14:42 pdrakeweb joined
14:45 <quintasan> Uh, does it? I have a model defined with many_to_many association defined for both models and #join(:studios) yields #<Sequel::SQLite::Dataset: "SELECT * FROM `animes` LEFT JOIN `studios`">
14:46 <Caesium> yeah, don't use join with associations, just use the methods. so something like.. a = Anime.first; a.studios => gives you an array of studios
14:46 <Caesium> if you need a dataset you can do a.studios_dataset and hten do more filtering on it
14:47 <Caesium> oh, you can also use association_join
14:47 <Caesium> so Anime.association_join(:studios) - should add the join condition
14:48 <quintasan> Caesium: association_join was what I was looking for. Thanks
15:08 arne joined
15:36 pdrakeweb joined
15:40 pdrakewe_ joined
16:28 kspencer_ joined
16:30 claudiuinberlin joined
16:36 pdrakeweb joined
17:08 pdrakeweb joined
17:21 bawigga joined
17:27 pdrakeweb joined
17:40 pdrakewe_ joined
17:51 claudiuinberlin joined
18:23 claudiuinberlin joined
19:07 pdrakeweb joined
19:10 pdrakeweb joined
20:42 pdrakeweb joined
20:58 pdrakeweb joined
21:41 joast joined