Activity Graph

Page 1 of 70 | Next »


[20:37:57] DoctorMonocular: has joined #RubyOnRails
[20:38:02] DoctorMonocular: has joined #ruby
[20:38:43] DoctorMonocular: hey I'm having some trouble here. For whateve rreason my mind just refuses to generate what I am guessing is an obvious recursive solution. I have this hash:
[20:38:55] DoctorMonocular: and I want to output all the possible combinations of those 4 dimensions
[20:43:37] DoctorMonocular: damn, that's great
[20:43:44] DoctorMonocular: didn't know there was a built in method
[20:44:47] DoctorMonocular: then I can zip that result with the original keys and get the labels back too
[22:16:06] DoctorMonocular: Quit: Leaving...


[00:25:33] DoctorMonocular: Net:
[01:19:28] DoctorMonocular: Remote host closed the connection


[23:52:11] DoctorMonocular: has joined #RubyOnRails
[23:52:46] DoctorMonocular: hey, I have a tricky problem
[23:53:27] DoctorMonocular: I have something like { '2019-02-27': { ... }, '2019-02-28': { ... }, ... }
[23:53:43] DoctorMonocular: it's a has with keys that are coniguous date strings
[23:53:58] DoctorMonocular: and each value is also a hash about those days
[23:54:49] DoctorMonocular: my goal is to group these keys so they create a sort of logical date span, based on the data inside each date
[23:55:38] DoctorMonocular: it's tricky because it's not a simple group_by operation--how to group the dates is based on weird business logic that has to do with the days before and after, as well as the data from a given day
[23:57:05] DoctorMonocular: but anywhere, there's some logic that I can use to convert that hash, to something like { ['2019-02-27', '2019-03-15']: { ... }, ...} which would just mean that the coniguous date range between the 27th and the 15th are grouped together
[23:57:45] DoctorMonocular: I an imagine funky, imperative array building to make this work, but I'd like something that's functional if possible


[01:15:34] DoctorMonocular: Remote host closed the connection


[18:23:11] DoctorMonocular: has joined #RubyOnRails
[18:26:32] DoctorMonocular: hey I am faking an upsert with mysql using Model.find_or_initialize_by().update().save! -- I have a collection of things that needs to be upserted, in addition to a few other things I want to happen with other models, all in the same transaction
[18:26:38] DoctorMonocular: so I have it all wrapped in a transaction
[18:26:52] DoctorMonocular: but I also want to lock the upserts
[18:27:35] DoctorMonocular: and I'm not really sure how I should be doing that. I guess I should do something like Model.find_or_initialize_by().lock!... ?
[18:29:07] DoctorMonocular: I guess I'm nervous about a race condition if that same transaction is happening on a different thread and it tries to upsert at the same time
[18:29:14] DoctorMonocular: I'm having trouble reasoning about it though


[00:00:08] DoctorMonocular: just make sure your hard drive is big enough for the data
[00:00:38] DoctorMonocular: normally the issue with projects like this is that the api you're hitting starts rejecting requests becuase you're hitting it too much or too often or something
[00:01:39] DoctorMonocular: ok well, then it should all work fine
[00:02:34] DoctorMonocular: for the record though, it seems weird to me that there is an api like this where you can potentially download nearly a tb of data and there's no access control of any kind
[00:02:43] DoctorMonocular: it's possible, of course
[00:03:01] DoctorMonocular: but if I were you I'd check with the api provider to be sure you're doing everything according to how they want it done
[02:39:15] DoctorMonocular: Remote host closed the connection
[17:22:52] DoctorMonocular: has joined #RubyOnRails
[17:24:06] DoctorMonocular: hey quick question -- is there a enumerable method that does something like select and reject at the same time? Or like unzipping a collection? The behavior would be like "select where .red?" and the method would return all the red things and it would also return all the not red things?
[17:24:28] DoctorMonocular: red, not_red = marbles.separate(&:red?)
[17:24:31] DoctorMonocular: something like that
[17:33:28] DoctorMonocular: hah, I thought there might be something!
[17:33:30] DoctorMonocular: amazing, thanks
[19:27:24] DoctorMonocular: dviola:
[19:56:25] DoctorMonocular: yeah it's a little kludgy but not too bad
[19:56:36] DoctorMonocular: plus you could make it dynamic
[19:57:02] DoctorMonocular: like %w(email,, foo, bar).join(' || ')
[22:22:07] DoctorMonocular: Remote host closed the connection


[21:18:29] DoctorMonocular: has joined #RubyOnRails
[21:19:52] DoctorMonocular: hey, so I have a range of TimeWithZones, and I try to compare 2 ranges that are identical like range_1 == range_2 -- this returns false. I check range_1.first == range_2.first #=> true, and range_1.last == range_2.last #=> true
[21:20:13] DoctorMonocular: I don't get how the first and last of a range could be equal but the ranges are unequal
[21:20:47] DoctorMonocular: the usual thing with times is that the usec is different, but in this case it's not true, they are all manually set to zero
[21:20:57] DoctorMonocular: there is absolutely no difference I can detect
[21:21:07] DoctorMonocular: and .inspect returns identical valurs
[21:22:31] DoctorMonocular: even this happens: range_1 == range_1.dup => false
[21:22:50] DoctorMonocular: I guess it's because the Range :== just does object identity?
[21:25:35] DoctorMonocular: according to the ruby docs, it doesn't just do object identity, it actually compares values
[21:27:10] DoctorMonocular: but also when I try just having a TimeWithZone instance I can do: t == t.dup #=> true
[21:27:15] DoctorMonocular: so I'm stumped here
[21:53:22] DoctorMonocular: no, I am manually making a timewithzone and manually setting usec to 0 on it
[22:08:02] DoctorMonocular: Remote host closed the connection
[22:52:34] DoctorMonocular: has joined #RubyOnRails
[22:52:36] DoctorMonocular: GOOD MORNING TO YOU RADAR
[23:35:59] DoctorMonocular: Postgres is fine
[23:45:21] DoctorMonocular: 100 000 rows is nothing, the database won't be your bottleneck here
[23:47:55] DoctorMonocular: you're going to need a big hard drive to hold 800gigs in the database alone though, and you're gonig to have to make sure that api you're hitting is fine with having those 800gigs downloaded from it
[23:48:42] DoctorMonocular: unless it's 8mb total? In which case there's no problem, that's not a lot of data to process
[23:52:23] DoctorMonocular: 800gb of traffic, followed by you storing most of it in a database row--that is going to take disk space
[23:59:56] DoctorMonocular: yeah ith this amount of data you can use standard tech like postgres and jobs


[03:26:41] DoctorMonocular: Remote host closed the connection


[02:15:43] DoctorMonocular: has joined #RubyOnRails
[02:16:29] DoctorMonocular: Quit: Leaving...
[18:38:04] DoctorMonocular: has joined #RubyOnRails
[18:38:41] DoctorMonocular: I'm having trouble with autoloading constants from a subfolder -- I have services/changeset_format and inside that folder I have classes all inside module ChangesetFormat
[18:38:50] DoctorMonocular: when I load rails it has the module defined
[18:38:54] DoctorMonocular: but nothing in it
[18:38:59] DoctorMonocular: none of the classes I defined
[18:39:37] DoctorMonocular: oh shit, I already figured out
[18:39:43] DoctorMonocular: thanks for being good rubber ducks
[18:49:23] DoctorMonocular: fuck, actually it's not fixed
[18:49:49] DoctorMonocular: the problem still is that I have a subfolder under app/services and none of the classes are being loaded
[18:50:29] DoctorMonocular: and I already that to be autoloaded what you have to do is have the subfolder match the name of the module for those classes and the name of the files as the class name
[18:50:31] DoctorMonocular: like this:
[18:50:43] DoctorMonocular: the module is defined but the classes aren't loaded
[18:54:36] DoctorMonocular: if I require one of hte files manually in the console
[18:54:39] DoctorMonocular: it's found and works fine
[21:08:56] DoctorMonocular: has joined #RubyonRails-offtopic
[21:09:39] DoctorMonocular: ok, I'm stumped -- I have a model with a field called data that I have as `serialize data, Hash`
[21:10:15] DoctorMonocular: there are a couple classes that I store in the data hash and that work fine
[21:10:53] DoctorMonocular: but when I try to deserialize it says `ArgumentError: undefined class/module MyClass::`
[21:11:17] DoctorMonocular: that happens by just doing like > MyModel.first in the console
[21:11:37] DoctorMonocular: but then also in the console right after that I can access the MyClass constant without an issue
[21:11:49] DoctorMonocular: so the deserialize is taking place in a different context maybe?
[21:11:57] DoctorMonocular: I have no idea how to even start debugging this


[05:23:41] DoctorMonocular: I'm hitting weird behavior -- I have like h =[]); and when I do h[:foo] I get a [] back like I want, but it doesn't stick if I do h[:foo] << 2
[05:23:52] DoctorMonocular: that returns [2], but the hash is unchanged
[05:24:06] DoctorMonocular: if I do h[:foo] = []
[05:24:09] DoctorMonocular: then it's there
[05:24:17] DoctorMonocular: but the default doesn't remain
[05:25:14] DoctorMonocular: I think I need to manually assign it in the block?
[05:27:30] DoctorMonocular: yeah, that was it
[05:27:39] DoctorMonocular: the hash block is responsible for actually persisting the thing
[06:33:22] DoctorMonocular: Remote host closed the connection
[17:38:06] DoctorMonocular: has joined #RubyOnRails
[17:38:41] DoctorMonocular: ok rubyists, riddle me this -- what's the most concise way to invert a hash like this:
[18:03:27] DoctorMonocular: Remote host closed the connection


[20:21:06] DoctorMonocular: Remote host closed the connection
[22:12:01] DoctorMonocular: has joined #RubyOnRails
[22:12:42] DoctorMonocular: I'm trying to do the normal pattern of method(thing_or_things); Array(thing_or_things).each... ; end;
[22:12:56] DoctorMonocular: but the thing in this case is already array-like
[22:13:09] DoctorMonocular: so when I pass a single one in like [1,2]
[22:13:20] DoctorMonocular: I want it to end up like [[1,2]]
[22:13:38] DoctorMonocular: which obviously doesn't work with Array()
[22:13:56] DoctorMonocular: what's my cleanest bet, without is_a?(Array) nonsense?
[22:15:14] DoctorMonocular: wouldn't that also fail in this case? if I pass [1,2] as the argument?
[22:16:15] DoctorMonocular: the items would be 1 and 2, instead of the items being a single value: [1,2]
[22:18:08] DoctorMonocular: I have a class that organizes datetime ranges using certain logic, and this method accepts either a single range or an array of ranges to do some logic to
[22:18:39] DoctorMonocular: but I actually do a duck type check, so I can accept anything that responds to :first and :last
[22:19:32] DoctorMonocular: but when I pass a single range in or any other single thing that responds to first and last, the Array() thing doesn't work for obvious reasons
[22:20:00] DoctorMonocular: eh. Yeah I guess. That might be cleanest
[22:21:08] DoctorMonocular:
[22:21:08] DoctorMonocular: I doubnt it's helpful, but here:
[22:21:40] DoctorMonocular: block is canonically a range, but actually can be anything that responds to :first and :last, like I said
[22:25:21] DoctorMonocular: ok, I think I'll do that
[22:27:52] DoctorMonocular: that is exactly what I wrote, yeah
[23:31:24] DoctorMonocular: ok, so I know this is a bad idea, but I want to know for future reference
[23:31:48] DoctorMonocular: say I want to allow arbitrary meta data to be added to any object
[23:32:17] DoctorMonocular: so I could monkeypatch Object with something like a meta hash instance variable
[23:32:22] DoctorMonocular: then be able to do like 1.meta
[23:32:42] DoctorMonocular: but what if I only want to enable meta data on a given object instance on purpose?
[23:33:02] DoctorMonocular: like 1.meta would blow up, but something like 1.with_meta.meta would work?
[23:33:31] DoctorMonocular: with_meta needs to be monkey patched into Object, but is it possible to inject the meta hash or whatever directly into the instance?


[22:28:00] DoctorMonocular: has joined #RubyOnRails
[22:28:18] DoctorMonocular: hey, what's the usual way to handle testing when you have large object graphs for your models?
[22:28:37] DoctorMonocular: just like, eat shit and deal with it? Presumably you mock as much as possible


[01:00:10] DoctorMonocular: has joined #RubyOnRails
[01:01:46] DoctorMonocular: hey, I have an activerecord model I run a query for by doing some stuff like query = Model.where(...).etc , then return query.all
[01:02:10] DoctorMonocular: then I later take that result and run a result.each
[01:02:21] DoctorMonocular: and when I do that it runs the query again
[01:02:28] DoctorMonocular: why might that be?
[01:05:36] DoctorMonocular: I do -- is the usual behavior for each to trigger a new query for a relation?
[01:33:54] DoctorMonocular: Remote host closed the connection


[02:53:19] DoctorMonocular: has joined #ruby
[02:53:58] DoctorMonocular: I'm annoyed. I have a method that takes either single things or an array of things and starts by doing thing = Array(thing_or_things)
[02:54:07] DoctorMonocular: which works and is idiomatic
[02:54:28] DoctorMonocular: but when thing is a hash it fucks up by converting {a: :b} into [[:a, :b]]
[02:54:42] DoctorMonocular: I want [{a: :b}]
[02:54:50] DoctorMonocular: like it work with any other variable
[02:55:03] DoctorMonocular: is there some way to do that without uglying up my code?
[03:28:23] DoctorMonocular: Remote host closed the connection


[16:38:43] DoctorMonocular: has joined #RubyOnRails
[16:39:39] DoctorMonocular: hey, I'm debating between paper_trail, audited, or custom solution
[16:39:48] DoctorMonocular: one thing I'm wondering is performance impact
[16:39:51] DoctorMonocular: how bad are they?
[17:57:51] DoctorMonocular: Remote host closed the connection


[17:14:00] DoctorMonocular: has joined #RubyOnRails
[17:14:35] DoctorMonocular: I used to use the classy_enum gem, but it's pretty old and I'm worried that it will break at some unknown time
[17:14:42] DoctorMonocular: is there a gem the cool kid use now?
[17:25:02] DoctorMonocular: thanks havenwood -- it looks different, but maybe I'll just use the different api :)
[18:03:09] DoctorMonocular: Remote host closed the connection


[23:06:29] DoctorMonocular: Ping timeout: 265 seconds


[06:00:26] DoctorMonocular: has joined #RubyonRails-offtopic
[06:00:38] DoctorMonocular: yo Radar, I just watched your exploding rails video
[06:00:43] DoctorMonocular: wanted to let you know :)
[06:02:33] DoctorMonocular: I already do some of that stuff, but I haven't actually stopped using activerecord yet
[06:03:01] DoctorMonocular: I more like use it with a limited subset and commandments such as THOU SHOULT NOT USE CALLBACKS, YOU FUCKING CHUMP
[06:03:35] DoctorMonocular: but I'll check out your repo to see how you did things
[14:46:51] DoctorMonocular: HalcyonicStorm__: it is sad :/
[14:47:27] DoctorMonocular: over the years I've had enough communities that I wish there was some kind of clearing house, like "the thing you all came together to talk about is in the past, but you can still be here"
[14:48:47] DoctorMonocular: yeah, my thing is that I'm not writing ruby lately either, I'm working on a game in Unity
[14:51:31] DoctorMonocular: I never really gave unreal a fair shake
[14:51:58] DoctorMonocular: I like/know c# more than c++, and I like the architecture better, prima facie
[14:52:00] DoctorMonocular: so I went for it
[14:52:26] DoctorMonocular: plus none of the games I want to build need AAA graphics, so Unity seemed fine
[15:27:58] DoctorMonocular: I'm at the point with unity where I have to forrest gump my way through a lot of the esotera, but I could be a productive programmer on a team who had more collective experience


[06:50:29] DoctorMonocular: Read error: Connection reset by peer


[00:50:38] DoctorMonocular: has joined #RubyOnRails
[00:50:55] DoctorMonocular: hey, I'm trying to make an ajax call, and it's complaining that rails-ujs is already loaded
[00:50:59] DoctorMonocular: and it's fucking up the call
[00:51:10] DoctorMonocular: I want these links to ignore all the rails things and just do what I want


[03:30:43] DoctorMonocular: anyone around? I want to talk about authorization-aware form fields
[03:30:54] DoctorMonocular: like defining field-level permissions per role
[03:59:52] DoctorMonocular: I'm building it currently. What I'm attempting is a custome form builder that checks permissions when you call f.input or whatever, then displays the field as appropriate. I just predict it's going to get pretty fucking hairy to have to manually infer the field type and stuff from the column type
[04:00:05] DoctorMonocular: like, poaert of me think I shoukld actually extend simple_Form or something
[04:00:45] DoctorMonocular: but more dependencies on an already complex thing gives me hemorrhoids
[04:02:03] DoctorMonocular: mainly I'm trying to avoid ugly if statements around every fucking field in the app
[08:16:13] DoctorMonocular: Remote host closed the connection


[05:33:36] DoctorMonocular: has joined #RubyOnRails
[05:33:38] DoctorMonocular: has joined #RubyonRails-offtopic
[05:41:21] DoctorMonocular: I'm guessing it's a regression, because in that thread
[05:41:32] DoctorMonocular: schneems closed it with a commit
[05:41:50] DoctorMonocular: then recently some other guy showed up, and I showed up and we're like, no it's broken
[19:26:24] DoctorMonocular: concerns in my new project are just failing silently. Am I doing something boneheaded here? Check out this:
[19:36:58] DoctorMonocular: the module just isn't being included at all, but no error is raised on the include PasswordUpgradable either


[02:55:07] DoctorMonocular: i just pulled down an older repo of mine, and when I run it unicorn throws an error about the /log not being writeable
[02:55:18] DoctorMonocular: the log in the app folder is 755
[02:55:30] DoctorMonocular: and for funsies, just in case I created a root level /log folder
[02:55:38] DoctorMonocular: and it still says that
[02:55:43] DoctorMonocular: what might be happening here?
[02:56:21] DoctorMonocular: wow, super typo. *yeah probably
[02:56:32] DoctorMonocular: this is the story of my day. Just esoteric shit going wrong
[02:57:18] DoctorMonocular: oh good. I changed /log to 777
[02:57:30] DoctorMonocular: and it runs without error then immedaitely shuts down without any message whatsoever
[02:58:28] DoctorMonocular: this one I can figure out though


[18:54:46] DoctorMonocular: has joined #RubyOnRails
[18:54:47] DoctorMonocular: has joined #RubyonRails-offtopic


[20:12:50] DoctorMonocular: has joined #RubyonRails-offtopic
[22:18:25] DoctorMonocular: Remote host closed the connection
[22:18:59] DoctorMonocular: has joined #RubyonRails-offtopic
[22:18:59] DoctorMonocular: has joined #RubyOnRails
[22:23:05] DoctorMonocular: Ping timeout: 240 seconds


[06:15:58] DoctorMonocular: has joined #RubyOnRails
[06:16:17] DoctorMonocular: has joined #RubyonRails-offtopic
[06:26:47] DoctorMonocular: Read error: Connection reset by peer
[06:27:46] DoctorMonocular: has joined #RubyonRails-offtopic


[03:43:27] DoctorMonocular: has joined #RubyonRails-offtopic


[22:04:26] DoctorMonocular: I assume it only works if the routes are RESTful and can respond to json?
[22:04:37] DoctorMonocular: there's no real documentation about it anywhere though
[22:51:08] DoctorMonocular: yeah I can't seem to figure this out
[22:51:15] DoctorMonocular: I looked at the kaminari code
[22:51:24] DoctorMonocular: found the place where you pass the remote: option in
[22:51:32] DoctorMonocular: it gets passed to Paginator
[22:51:39] DoctorMonocular: then Paginator doesn't do anything with it at all
[22:51:49] DoctorMonocular: that's hte only place I can find it, so I'm stumped
[22:52:55] DoctorMonocular: I guess maybe it's just passing the data-remote attr to the link tag, and rails is supposed to handle the rest somehow?
[23:42:32] DoctorMonocular: matthewd: do you know some details about how it works? Like, is it smart enough to figure it out if the endpoint returns html?
[23:42:42] DoctorMonocular: I'm confused about how it works internally
[23:48:28] DoctorMonocular: got it, alright
[23:48:31] DoctorMonocular: thanks anyway :)