DoctorMonocular

Activity Graph

Page 1 of 70 | Next »

2019-06-11

[17:23:00] DoctorMonocular: has joined #RubyonRails-offtopic
[22:22:14] DoctorMonocular: Quit: Leaving...

2019-06-03

[18:40:48] DoctorMonocular: has joined #RubyOnRails
[18:42:04] DoctorMonocular: does anyone know of a gem that has the functionality, maybe just internal, of a form builder app like typeform or wufoo? It's impossible to google because "rails form builder" is the internal api for making any form, not an app for end users to make their own forms with
[19:01:50] DoctorMonocular: Remote host closed the connection

2019-06-02

[00:56:51] DoctorMonocular: has joined #RubyonRails-offtopic
[00:57:19] DoctorMonocular: I'm seriously considering using different devise models to handle different types of users, as opposed to roles, and I want to talk it through with someone
[00:59:14] DoctorMonocular: I have a multitenant app where my customers, people who run events, can run events for their customers, the participants. Admins, org staff, and participants are very much separate things that will need basically all separate logic
[00:59:49] DoctorMonocular: further, my plan is to scale by sharding the database along rthe lines of the orgs, such that each org has their own database
[01:00:42] DoctorMonocular: the only ereal downside I can see to using separate devise models is that people who happen to be both staff in one place and participants in another will have to have separate logins for those different things
[01:01:12] DoctorMonocular: and people who participate with more than one org, by coincidence, will also need to have separate logins for that
[01:50:15] DoctorMonocular: Remote host closed the connection

2019-06-01

[16:07:04] DoctorMonocular: has joined #RubyOnRails
[16:08:08] DoctorMonocular: hey I'm having trouble setting up a tricky route
[16:08:13] DoctorMonocular: here's my attempt: https://gist.github.com/PeteMichaud/003d7faaedbe4067a9d8e778ecbf5825
[16:08:37] DoctorMonocular: I want myapp.com/:slug to go to the organization that has that :slug
[16:09:03] DoctorMonocular: but I also want myapp.com/ to go to a different place, thehome page
[16:09:53] DoctorMonocular: right now I have the homepage loading, but if I try any slug, it just fails as no route matches [get] "/testslug"
[18:28:33] DoctorMonocular: Exuma: does the internal method catch its own exception? to make a transaction roll back the exception has to hit it, not be caught
[18:29:21] DoctorMonocular: naltun: do they share a database?
[19:16:20] DoctorMonocular: I'm having trouble creating a custom primary key. I have a psql function called id_generator, and I call it like this: https://gist.github.com/PeteMichaud/c20fe0a16f1c7c2d912eb69282bb4404
[19:16:40] DoctorMonocular: the function works if I call it directly, creating a bigint
[19:16:56] DoctorMonocular: but when rails saves a new organization the value is always 0
[19:17:00] DoctorMonocular: what am I doing wrong?
[19:55:20] DoctorMonocular: I don't understand the question
[19:55:43] DoctorMonocular: org has people, person has_one org, both have addresses
[19:56:05] DoctorMonocular: has_many :people should just work
[19:56:18] DoctorMonocular: or has_many :members, class: Person or whatever
[19:56:44] DoctorMonocular: class_name, I can't remember the exact option
[19:57:45] DoctorMonocular: yeah I'm saying I don't know why you have that and suspect you should replace it
[19:57:52] DoctorMonocular: with has_many :people
[19:58:56] DoctorMonocular: I still don't really understand what you mean by that -- of course you can join any tables, but what are you actually trying to do?
[20:00:09] DoctorMonocular: you want a full text search
[20:00:33] DoctorMonocular: I didn't actually read this, but a quick google turned up: https://www.calebthompson.io/talks/search/
[20:00:42] DoctorMonocular: that is the key word you're looking for though
[20:03:52] DoctorMonocular: well, it's related -- full text search CAN be on a single table, it's actually a way of sort of combining columns into a single, internal index column and being able to say "is there text in this similar to the following search string?"" and the thing is that you can set up that search to go across whatever tables you want
[20:06:50] DoctorMonocular: yeah it's a little tricky because it sounds like it can only do text columns or whatever
[20:07:13] DoctorMonocular: but actually what's happening is that the values of whatever columns you want are being combined into a single, text-based, search column
[22:29:56] DoctorMonocular: Quit: Leaving...

2019-05-31

[06:36:20] DoctorMonocular: has joined #RubyOnRails
[06:37:37] DoctorMonocular: I have an overbroad question -- I want to learn more about devops. I want to Do It Actually Right when it comes to deployment -- I can hack and slash my way through setting up a VPS and deploying a rails app, but I know that Doing It Right means not having to do that, but instead setting up some way of being automated
[06:38:21] DoctorMonocular: but it's daunting to get into. I know most of the alternatives, but I have no idea howto evaluate them or how to get something working that I
[06:38:27] DoctorMonocular: m confident I'm not fucking up
[06:38:48] DoctorMonocular: is there a good guide? I have CircleCI set up to build, and I want to get it to deploy to a staging VPS
[06:56:39] DoctorMonocular: what is the problem?
[06:59:04] DoctorMonocular: I think you need to put the id declaration into html_options
[06:59:19] DoctorMonocular: I think what you're asking is howto make a button with the html id of 'search', right?
[07:31:34] DoctorMonocular: Remote host closed the connection
[20:58:27] DoctorMonocular: has joined #RubyOnRails
[20:59:07] DoctorMonocular: hey can someone talk to me about multitenant apps? I'm making srchitectural decisions right now that will be hard to go back from
[20:59:33] DoctorMonocular: how fucked am I if I decide to try to use apartment with multiple pg databases? I've already seen that multiple schemas is a bad idea
[20:59:58] DoctorMonocular: but maybe the whole tyhing is a bad idea, maybe I should just use a fk and deal with it when some data leaks inevitably
[22:05:32] DoctorMonocular: Remote host closed the connection

2019-03-03

[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: https://gist.github.com/PeteMichaud/c12e495f143f57b8a8cf712736a3dff1
[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...

2019-02-28

[00:25:33] DoctorMonocular: Net: https://www.jvt.me/posts/2017/06/22/yaml-to-json/
[01:19:28] DoctorMonocular: Remote host closed the connection

2019-02-27

[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

2019-02-21

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

2019-02-20

[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

2019-02-19

[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: https://blog.lateral.io/2015/05/full-text-search-in-milliseconds-with-postgresql/
[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, organizations.name, foo, bar).join(' || ')
[22:22:07] DoctorMonocular: Remote host closed the connection

2019-02-18

[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

2019-01-27

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

2019-01-26

[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: https://gist.github.com/PeteMichaud/63e477e119b4fdda5345b9f11d1f2185
[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

2019-01-25

[05:23:41] DoctorMonocular: I'm hitting weird behavior -- I have like h = Hash.new([]); 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 hash.new 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: https://gist.github.com/PeteMichaud/bc3ed6058841abd402eb6f1abd270344
[18:03:27] DoctorMonocular: Remote host closed the connection

2019-01-24

[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: https://gist.github.com/PeteMichaud/d4d478618a7b332b7933a4e96eafddc8
[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?

2019-01-23

[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

2019-01-22

[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

2018-09-20

[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

2018-09-19

[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

2018-09-18

[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

2018-05-12

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

2018-05-08

[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

2017-09-14

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

2017-09-11

[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

2017-09-10

[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