<    March 2017    >
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 23 24 25  
26 27 28 29 30 31
04:54 cyclotron3k joined
05:01 <cyclotron3k> If I have a before_save hook which modifies `field_a`, but I only modify `field_b` then call save_changes, `field_a` is set by the hook, but it doesn't seem to be included in the update query.
05:02 <cyclotron3k> Is this expected behaviour?
06:07 glennpratt joined
06:18 glennpratt joined
06:19 glennpratt joined
06:29 filterfish joined
07:53 glennpratt joined
07:57 ta_ joined
08:22 aidalgol joined
08:32 jaequery joined
08:48 glennpratt joined
10:36 glennpratt joined
12:24 glennpratt joined
13:54 banditron joined
15:05 glennpratt joined
15:09 ta_ joined
15:40 <jeremyevans> cyclotron3k: before_save is called before it determines which fields to be used. Can you post an example showing the issue you are having?
16:46 jaequery joined
17:11 glennpratt joined
19:23 GitHub89 joined
19:23 <GitHub89> [13sequel] 15jeremyevans pushed 3 new commits to 06master: 02https://git.io/vypf2
19:23 <GitHub89> 13sequel/06master 14b171b68 15Jeremy Evans: Deprecate support for some databases and adapters...
19:23 <GitHub89> 13sequel/06master 14cd569e9 15Jeremy Evans: Deprecate having duplicate column names in subclass tables when using the class_table_inheritance plugin (Fixes #1326)...
19:23 <GitHub89> 13sequel/06master 146195f25 15Jeremy Evans: Remove symbol splitting in example code in class_table_inheritance plugin
19:23 GitHub89 left
19:23 GitHub25 joined
19:23 <GitHub25> [13sequel] 15jeremyevans closed pull request #1326: Gracefully handles CTI for tables with duplicate columns (06master...06cti-duplicate-columns) 02https://git.io/vy5JL
19:23 GitHub25 left
19:24 jaequery joined
19:26 Renich joined
20:02 glennpratt joined
20:07 glennpratt joined
20:46 ta_ joined
21:07 GitHub101 joined
21:07 <GitHub101> [13sequel] 15kenaniah commented on issue #1326: All excellent suggestions. Is there a specific direction in which you would lean? 02https://git.io/vypWb
21:07 GitHub101 left
21:09 GitHub122 joined
21:09 <GitHub122> [13sequel] 15jeremyevans commented on issue #1326: @kenaniah I guess it depends on your needs. The :column_map option might be the easiest one to add support for, and it should handle your example. 02https://git.io/vypl4
21:09 GitHub122 left
21:17 <Bish> jaequery: this is ssuperlate but: DB[:companies].left_join(:users,:company_id=>:companies__id).group(:users__company_id).select { [companies__name,count(users__company_id)] }.order(:users__company_di)
21:17 <Bish> just happened to scrolll down this channel and saw your unanswered question
21:17 <Bish> atleast i think it's unanswered
21:18 <jaequery> thanks so much Bish!
21:18 <jaequery> i was actually still waiting for it!
21:18 <jaequery> lol
21:18 <jaequery> :p
21:18 <Bish> i haven't checked it either, but something like this would be it
21:18 <Bish> oh yes, i mate it the wrong way around, btw
21:19 <Bish> i joined companies from left
21:19 <Bish> but basicially join syntax is always .join(:joined_table,:joined_table__something_id=>:base_table__id)
21:19 <jaequery> ok cool
21:21 <Bish> in case you cannot order by the function count on your RDS, you want .from_self
21:23 <jaequery> RDS don't support count?
21:23 <Bish> nono, sometimes you can only order by fields which are in the table
21:23 <Bish> atleast afaik
21:23 glennpratt joined
21:24 <Bish> and since count(something) is not a table row, i think that can lead to problems
21:24 <Bish> not sure though
21:24 <jaequery> interesting
21:25 <Bish> i think mysql does that.. if you create a column on the fly, it won't allow you to order by that
21:25 <Bish> *tries*
21:26 <jaequery> im on postgres btw
21:26 <Bish> good choice!
21:26 <Bish> can't reproduce it either way.
21:27 <jaequery> ok so it works thx!
21:27 <Bish> happy to hear
21:27 <jaequery> its pretty interesting how this whole { ... } block work
21:27 <jaequery> like, .select{ ... }
21:27 <Bish> yeah it's ruby DSL magic
21:27 <Bish> basicially you can express all these things without, it's just more convinient this way
21:28 <Bish> like
21:28 <Bish> DB[:users].select { id.as(some_id) } == DB[:users].select(Sequel.as(:id,:some_id))
21:29 <Bish> first is much easier to read, while it for sure does the same
21:29 <jaequery> honestly i wish just passing in as string work too, Company.select('users.first_name, count(companies.user_id) as c')
21:29 <Bish> you can do that, but you almost never need to
21:29 <Bish> like, really, almost never
21:29 <jaequery> it works passing string too?
21:30 <jaequery> because it doesnt work for me
21:30 <Bish> DB[:table].select(Sequel.lit('asdhasdhasda'))
21:30 <Bish> but really, you don't need to, you really shouldn't but it's good to know
21:30 <Bish> lit an is literal
21:30 <Bish> as in*
21:30 <jaequery> i just stick to using one database , and i just like raw sql and dont really want the abstraction layer sometimes
21:31 <jaequery> ok
21:31 <Bish> well, i always could do the things i wanted with sql, but i never liked it, i hated it
21:31 <Bish> sequel made me enjoy building databases
21:31 <jaequery> hehe
21:31 <Bish> which is really an accomplishment, i really really hate sql, even though i could write anything in it
21:31 <jaequery> me too. but curious, have you ever used mongo?
21:32 <Bish> yes i did, worked well for me, but it's just hip, if you ask me
21:32 <Bish> data will always have relations at some point, and then you're lost
21:33 <Bish> also: wasn't there are guy which built an mongo-db wrapper around postgresql and had similiar performance?
21:33 <jaequery> one thing i wish sequel had , that mongoose (node.js orm) has is , the ease of using their .populate()
21:33 <Bish> also: postgres has json(b), which is way better and even indexable (dafuq!)
21:33 <Bish> what does it do?
21:34 <jaequery> like , lets say companies table has user_id, i want to do .. Company.all.populate(:user_id) , which will return companies record, with user object in it
21:34 <jaequery> i kind of got it to work when i created my own method but its been buggy
21:34 <Bish> well, you would do something like this with relations in a relational database
21:35 <Bish> and if you don't, which you should not, but if you cannot
21:35 <Bish> there is jsonb, which allows stuff like that
21:35 <jaequery> yea i know, i use jsonb
21:35 <Bish> and if it's the easy syntax you like about that: well, write a plugin that does what you want
21:36 <jaequery> yea
21:37 <jaequery> i know sequel has eager but that only seems to work for single records
21:37 <Bish> i never got what the advantage of eager is.. i always get my stuff on demand.. so to say
21:37 <Bish> tbh i never understood what eager is about and never needed it
21:37 <jaequery> heh yea i never really understood eager/graph too
21:37 <jaequery> i just go straight for joins
21:38 <Bish> but im pretty sure if you want something like.. load all relations optimisticially, there is something like it
21:38 <Bish> and it will outperform mongodb, as soon as you have relations.. hands down i guess
21:38 <Bish> i don't know if it matters if you have a lot of sharding, tho
21:39 <Bish> and do some funky map reduce stuff
21:39 <Bish> im not smart enough for that