LiamW

Activity Graph

Page 1 of 2 | Next »

2018-03-20

[01:47:39] LiamW: has joined #ruby
[01:48:23] LiamW: I have a strange problem
[01:48:51] LiamW: are there errors that begin; ...; rescue; end cannot catch?
[01:49:47] LiamW: this is happening to me: https://gist.github.com/liamwhite/552d9c2903cfc7ebe1cf63721d2b7808
[01:50:42] LiamW: RUBY_VERSION = "2.5.0" etc
[01:55:43] LiamW: never mind I'm dumb
[01:55:48] LiamW: it's an Exception not an Error
[01:55:50] LiamW: has left #ruby: ("WeeChat 2.0.1")

2018-03-10

[05:02:51] LiamW: has joined #RubyOnRails
[05:04:54] LiamW: is there a way to prevent activerecord from ever writing to a column
[05:05:33] LiamW: example: I select the model, I read the column, I make some changes, the update set ... query doesn't include the column when writing back
[05:06:16] LiamW: I set up a counter cache column that is managed by the database and I don't want activerecord to be able to get it to desync
[05:16:38] LiamW: ignored_columns doesn't work
[05:21:59] LiamW: okay, found out
[05:22:12] LiamW: Table.columns.delete_if { |c| c.name == 'a_counter_cache' }
[05:22:17] LiamW: works just fine
[05:22:34] LiamW: rails won't update the column anymore after running that
[05:27:17] LiamW: has left #RubyOnRails: ("WeeChat 2.0.1")

2018-03-03

[01:52:17] LiamW: has joined #ruby
[01:52:26] LiamW: im setlocal_OP__WC__0 what does WC stand for?
[03:04:01] LiamW: thanks for all the help...
[14:59:50] LiamW: has left #ruby: ("WeeChat 2.0.1")

2018-02-26

[03:55:34] LiamW: has joined #RubyOnRails
[03:55:44] LiamW: stupid question
[03:55:59] LiamW: when I set the stderr_path for my unicorn it logs every request it receives
[03:56:04] LiamW: how do I disable this
[03:56:16] LiamW: I want to see warnings and errors only
[03:58:21] LiamW: the request lines are not prefixed with "I, " so something is writing directly to stderr
[03:58:26] LiamW: instead of through the logger
[04:12:34] LiamW: passing -N gets it to stop logging the requests, but now it also seems to log nothing
[12:04:24] LiamW: has left #RubyOnRails: ("WeeChat 2.0.1")

2018-02-24

[16:53:32] LiamW: has joined #RubyOnRails
[16:58:57] LiamW: has left #RubyOnRails: ("WeeChat 2.0.1")

2018-02-21

[00:39:55] LiamW: has joined #RubyOnRails
[00:40:31] LiamW: https://gist.github.com/anonymous/ec5eae0adc1130100c84efcdaf26516b
[00:40:42] LiamW: I have a bunch of these queries that have been running for days
[00:40:44] LiamW: are they safe to kill
[00:46:46] LiamW: rails creates them
[00:47:13] LiamW: stackoverflow & prior knowledge
[00:47:26] LiamW: when you deploy to production rails doesn't read from the schema file, it instead reads the schema from the database directly using these queries
[00:47:53] LiamW: because they're taking up connection slots
[00:47:55] LiamW: I only have so many
[00:48:11] LiamW: also they've been running for 16 days
[00:48:12] LiamW: I just checked
[00:48:20] LiamW: safe to say they're not ever going to return results
[00:49:14] LiamW: this is a question about rails
[00:49:22] LiamW: I know how to use postgres
[00:49:31] LiamW: rails originates the query, I need to know if it's safe to kill
[01:49:09] LiamW: has left #RubyOnRails: ("WeeChat 2.0.1")

2018-01-15

[01:39:36] LiamW: has left #RubyOnRails: ("WeeChat 1.8")

2018-01-14

[16:30:37] LiamW: has joined #RubyOnRails
[16:35:27] LiamW: https://github.com/rails/rails/issues/21948
[16:35:29] LiamW: I'm having this problem
[16:35:43] LiamW: is there anything I can do about it that is not already a suggested workaround in the comments
[19:39:38] LiamW: any ideas for the csrf thing
[19:40:07] LiamW: I believe I tried or looked into every suggested solution and workaround in there
[21:53:20] LiamW: desnudopenguino: I'm still having csrf issues :/
[21:53:31] LiamW: prod only, I tried everything I could think of
[21:53:36] LiamW: https://github.com/rails/rails/issues/21948
[21:53:40] LiamW: and everything in here
[23:43:00] LiamW: desnudopenguino: I think I figured it out
[23:43:13] LiamW: the secureheaders gem was setting SameSite=Lax on my session cookie
[23:43:21] LiamW: I disabled that and things seem to work now

2018-01-01

[22:43:35] LiamW: has joined #RubyOnRails
[22:44:01] LiamW: I'm trying to rescue_from ActionController::UnknownFormat but rails isn't rescuing it, why not?
[22:44:07] LiamW: (rails 5.1.4 on ruby 2.5)
[22:45:47] LiamW: ah damnit never mind
[22:45:50] LiamW: I had an error in my rescue_from block
[22:57:43] LiamW: has left #RubyOnRails: ("WeeChat 1.8")

2017-08-07

[00:14:57] LiamW: impermanence: what exactly does it do?
[00:15:36] LiamW: it looks like a mapreduce sort of thing
[00:16:32] LiamW: no this isn't map reduce
[00:16:41] LiamW: but there's shorthand for this
[00:16:59] LiamW: chunk and group_by
[00:20:23] LiamW: >> Process.wait
[00:20:34] LiamW: wat, it didn't error?
[00:20:53] LiamW: "Forbidden syscall waitpid"
[00:21:35] LiamW: how do I stop getting nerd baited
[00:26:11] LiamW: what's with the Pair class
[00:26:33] LiamW: ACTION leaves impermanence to go ponder its existence
[00:27:51] LiamW: yeah but why do you need a pair class
[00:27:57] LiamW: also you can tab complete nicks
[00:28:54] LiamW: why not just a 2-tuple (array)
[01:18:00] LiamW: has left #ruby: ("WeeChat 1.8")

2017-08-06

[16:40:17] LiamW: has joined #ruby
[16:40:35] LiamW: so I've noticed that Kernel#` when called in a tight loop tends to create zombies
[16:40:54] LiamW: would that be a bug in ruby or in libc?
[16:42:16] LiamW: loop { Process.wait } reaps them, obviously
[16:42:40] LiamW: but they shouldn't be sticking around in the first place
[17:24:23] LiamW: apeiros: but how could it be waiting if it created a zombie?
[20:47:02] LiamW: apeiros: 4_500_000.times { `echo` }
[20:47:05] LiamW: seems to do it
[20:47:25] LiamW: (that'll take 10-15 minutes)
[20:47:54] LiamW: I'm testing with a C version to see if I can get the same bug
[20:48:00] LiamW: it might be ruby just failing to wait()
[20:50:36] LiamW: C version didn't bug

2017-07-24

[04:11:28] LiamW: has left #RubyOnRails: ("WeeChat 1.8")

2017-07-23

[14:57:00] LiamW: has joined #RubyOnRails
[14:57:20] LiamW: quick question
[14:57:35] LiamW: why aren't the *.rubyonrails.org domains served via tls?
[16:30:51] LiamW: the best way to gain experience is to work on a site that already "made it"
[17:19:33] LiamW: the guides don't emphasize REST strongly enough
[17:19:59] LiamW: and without a RESTful design you basically stray off the "Rails way"
[17:20:29] LiamW: I mostly avoid the guides anyway except when looking up specific methods or doing an upgrade
[17:24:08] LiamW: it's most important to know ruby to get rails down
[17:24:49] LiamW: knowing ruby very well would give you a sense of what to do re the migration issued
[17:25:17] LiamW: and keep in mind that you can make your frontend better by having less code there
[17:26:28] LiamW: js libraries are not a prerequisite for having a well-factored frontend
[17:27:03] LiamW: js modules almost certainly are, though https://github.com/liamwhite/sprockets-rollup
[17:27:53] LiamW: </blatant shill>
[17:30:29] LiamW: and to go along with that I have some bits and bobs that you can just pop into an app https://github.com/liamwhite/js-utils
[17:33:47] LiamW: I use ES6 with a module compiler for browsers because I've found ES6 to be very pleasant to write compared to ES5, and it will eventually end up supported in all browsers, whereas Coffee and other compile-to-JS languages won't (and will have learning overhead)
[17:34:03] LiamW: Coffee in fact has a broken grammar and I recommend avoiding it
[17:34:58] LiamW: You might want to use webpack if you're super fond of the node ecosystem and are OK with just adding frontend libraries as you like
[17:38:15] LiamW: I tend to write my code as minimally as possible while still maintaining a level of convenience
[17:40:37] LiamW: how well do you know ES5?
[17:45:26] LiamW: you're straying off the frontend mininalism path so I'll leave you there
[17:45:45] LiamW: but for backend you have to really take REST to heart
[17:46:11] LiamW: http://jeromedalbert.com/how-dhh-organizes-his-rails-controllers/
[17:52:44] LiamW: asking again because I wasn't answered earlier:
[17:52:47] LiamW: <LiamW> why aren't the *.rubyonrails.org domains served via tls?
[17:55:49] LiamW: TLS = transport layer security
[19:14:51] LiamW: psql> \d OrderStatuses
[19:28:40] LiamW: wow I wonder why it says that the table doesn't exist
[19:30:18] LiamW: do this in your migration instead add_reference(:orders, :order_status, {:foreign_key=>true})
[19:31:20] LiamW: you're trying to reference :OrderStatuses
[19:31:22] LiamW: for some reason
[19:31:41] LiamW: idk you haven't linked the migration file
[19:34:31] LiamW: gist the contents of the migration file
[19:34:45] LiamW: the table literally doesn't exist, read the error message
[19:34:56] LiamW: it's trying to reference a table called OrderStatuses
[19:35:04] LiamW: the table is actually called order_statuses
[19:36:58] LiamW: wrong migration
[19:37:10] LiamW: gist 20170704220741_add_foreign_key_to_orders.rb
[19:38:49] LiamW: see that line right there `add_reference :orders, :OrderStatus, foreign_key: true`
[19:38:51] LiamW: that is wrong
[19:39:05] LiamW: it needs to be `add_reference :orders, :order_statuses, foreign_key: true`
[19:39:59] LiamW: actually it needs to be `add_reference :orders, :order_status, foreign_key: true` because pluralization but that's why your migration won't work
[22:28:41] LiamW: I would think that at least defending the documentation pages against trivial MITM attacks should be high up on the list of things to do
[22:30:52] LiamW: they do in an otherwise properly-configured setup
[22:31:49] LiamW: if you're going to make a point about using EV certs, EV certs don't provide any special level of protection that DV doesn't https://www.troyhunt.com/on-the-perceived-value-ev-certs-cas-phishing-lets-encrypt/
[22:34:27] LiamW: preload the cert and use a public key pin
[22:34:41] LiamW: that will get you the vast majority of the way to blocking those attacks
[22:38:10] LiamW: that isn't the point of the article
[22:38:31] LiamW: the point is that both EV and DV will keep your connection _private_ and that the difference between them is mostly irrelevant
[22:42:31] LiamW: 03:12:26 < *> Moonlightning discovers the Rails docs are a website that doesn't support TLS
[22:42:34] LiamW: 03:12:49 <Moonlightning> okay, how long until we get attacks by spoofing API docs and tricking developers into introducing security holes into their apps?
[22:42:53] LiamW: is the context
[22:43:13] LiamW: normally I wouldn't care but for how easy it is to set up a DV cert using e.g. letsencrypt I felt it worthwhile to pass that on
[22:43:29] LiamW: as in "5-10 minutes of setup" easy
[22:44:45] LiamW: the other thing about getting TLS is that it will put the actual official rails documentation above APIDock in google search results
[22:46:52] LiamW: based on what's written here https://blog.cloudflare.com/secure-and-fast-github-pages-with-cloudflare/ you can simply use a TLS proxy to fetch securely from GH pages and then serve to the domain itself
[22:47:06] LiamW: it need not be cloudflare, in case you don't like the "all eggs in one basket thing"
[22:47:15] LiamW: it can just be a simple VPS running nginx
[22:49:26] LiamW: could host the static pages for real on aforementioned VPS, and update them automatically on push to the github pages repo via a webhook
[23:02:41] LiamW: on the non technical aspect I think that having an explicit enumeration of genders is probably a bad idea
[23:05:53] LiamW: sooner or later you'll end up with someone in your data that doesn't fit any precise definition of male or female
[23:06:40] LiamW: if you meant to record sex, then you could probably get away with that
[23:07:17] LiamW: I'm not referring to trans
[23:07:56] LiamW: I'm also not referring to the sort of "gender of the day" people that you might think I am
[23:08:04] LiamW: I'm just saying that it's not as meaningful as you probably think it is

2017-07-10

[10:40:14] LiamW: has joined #RubyOnRails
[10:41:10] LiamW: is it possible to have a modular config/routes? (main routes file requires and calls separate files in a subdirectory)
[10:41:33] LiamW: if not can I hack up binding etc. to do it?
[11:00:04] LiamW: raw sql isn't always a bad thing
[11:12:29] LiamW: vedu: I read tbe whole routing guide and sse
[11:12:39] LiamW: saw nothing relevant
[11:15:03] LiamW: I'm looking to split up the routes file itself
[11:15:33] LiamW: it's unmaintainably long as is
[11:26:12] LiamW: I figured
[11:26:19] LiamW: that'll work
[15:57:38] LiamW: sylario: but do you know how to write sql
[15:57:55] LiamW: then what you're doing is fine
[15:57:58] LiamW: carry on then
[16:21:49] LiamW: has left #RubyOnRails: ("WeeChat 1.8")

2016-06-22

[06:48:48] LiamW: has joined #RubyonRails-offtopic

2016-05-05

[19:56:12] LiamW: has joined #RubyOnRails

2016-04-15

[15:44:20] LiamW: has joined #RubyOnRails
[15:50:26] LiamW: Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo

2015-12-27

[00:13:51] LiamW: has joined #RubyOnRails
[00:14:07] LiamW: oh ffs freenode, get fucked

2015-12-06

[13:47:53] LiamW: has joined #RubyOnRails

2015-11-26

[19:01:59] LiamW: *.net *.split

2015-11-22

[03:46:50] LiamW: has joined #RubyOnRails

2015-11-10

[12:38:14] LiamW: has joined #RubyOnRails
[12:38:14] LiamW: has joined #ruby

2015-11-05

[14:47:10] LiamW: has joined #RubyOnRails

2015-10-31

[16:46:43] LiamW: has joined #RubyOnRails
[16:54:32] LiamW: freenode is a gigantic piece of shit

2015-08-27

[17:53:49] LiamW: when I wrote a small luajit app, it was so fast fetching from cache was slower than rendering
[17:54:19] LiamW: also tubbo reading those call me maybe things now
[17:55:08] LiamW: tubbo: we've had elasticsearch randomly kill off 2 shards and break our site before
[17:55:22] LiamW: took 6 hours to get us back running
[17:56:49] LiamW: tubbo: we've not had any issues with mongo yet except a huge performance regression from 2.6 to 3.0
[17:57:22] LiamW: it was so bad we had to turn the site off a few hours after the upgrade completed and figure out what to do
[17:57:40] LiamW: we had to limit PM threads to 1000 pages and use elasticsearch to paginate forum threads
[17:57:47] LiamW: it was a nightmare
[18:01:52] LiamW: I wasn't involved in the decision for this.
[18:02:02] LiamW: I would recommend using a relational database for making a forum.
[18:03:19] LiamW: did you try it? :p
[18:03:47] LiamW: well that current setup is returning nil from can_it_be_locked? which is falsy
[18:06:35] LiamW: you're not adding errors during validation time
[18:06:41] LiamW: although I don't think that matters
[18:06:59] LiamW: I think you probably just want a custom validation block, could help with clarity
[18:07:20] LiamW: validate do ..etc
[18:09:08] LiamW: it will look for a method called locked on your model
[18:09:39] LiamW: validate :locked will try to run def locked
[18:09:53] LiamW: it is the same thing as validate do
[18:09:58] LiamW: .. contents of def locked ..
[18:10:51] LiamW: only if you make it
[18:11:01] LiamW: which is why I'm recommending you use a custom validation block
[18:11:13] LiamW: you're confusing yourself greatly by trying to use validates_presence_of
[18:11:47] LiamW: validate do
[18:12:00] LiamW: if locked_is_required_for_some_reason
[18:12:36] LiamW: self.errors.add(:locked) if locked.nil?
[18:13:42] LiamW: ain't morning here
[18:16:31] LiamW: https://gist.github.com/anonymous/eb9768a08997921debe9
[18:16:36] LiamW: I was just supposing you do something like that
[18:20:15] LiamW: named scopes are nice
[18:20:36] LiamW: just stay away from default_scope unless you really know what you're doing
[18:20:54] LiamW: scopes are chainable AFAIK
[18:21:29] LiamW: I used default_scope once
[18:21:31] LiamW: it was bad
[18:21:41] LiamW: I won't say don't use it, just use it carefully
[18:32:40] LiamW: github just changed their notification icon from a box to a bell
[18:32:42] LiamW: interesting
[18:34:16] LiamW: I didn't know #update was a thing in AR
[18:34:20] LiamW: I'll have to read more on that
[18:35:34] LiamW: #set does that too if you have a model object already, that I knew about
[18:35:40] LiamW: but iirc it doesn't validate?
[18:38:22] LiamW: also I'm used to working with mongoid
[18:49:55] LiamW: Quit: http://www.kiwiirc.com/ - A hand crafted IRC client