#RubyOnRails - 14 August 2019
« Back 1 day Forward 1 day »
[00:31:49] regedit: apparently it should exist? https://apidock.com/rails/v4.2.1/ActiveRecord/Sanitization/ClassMethods/sanitize_sql_like
[12:47:45] pavelz: if anyone dealth with mock verification/validation can someone give me a list of words to look for I am at a loss trying to validate for example included gem to make sure that for example that certain types of requests still work. for example - http.requst("host.com", "DELETE") - imaginary request might stop working , while this should be wrapped in a different class that is tested. I wonder if I mock
[12:47:51] pavelz: http.request - is there programmatic way to validate that "DELETE" is present for this code ? so that it is safe to use mocks down the road /
[14:31:29] mgab: Is using a boolean flag in a database to determine which relationship to transcend considered bad design? I am struggling to see some logic that some members of my team are describing. For example we have three models, Client, Organization and Person. The client_id is stored on the Organization or Person and a boolean is set on Client so that wh
[14:31:29] mgab: en true, look at Organization -- else, look at Person. Just curious how others would handle it.
[14:33:17] mgab: To me, we limit our customer types. To them, we will only have two types. But we've already somewhere decided that we might have more than two by carrying the client_id on them, easy to introduce a third.
[16:51:33] herbst: Hey there! Can anyone possibly help me with a puma issue i face? I am trying to implement phased-restart. However everytime i run the command from my git hook (same user tho) i end up with 502 Bad Gateway and the following in my log: *75 connect() to unix:///.../puma.sock failed (111: Connection refused) while connecting to upstream
[18:11:28] NL3limin4t0r: Too bad mgab is already gone it sounds like he's looking for polymorphic associations.
[19:24:52] regedit: is it possible to complete the HTTP response, flush, close connection on the client, while still finishing up a bit of work server side?
[19:26:26] regedit: i know in PHP for example you can do ignore_user_abort() and flush() and stuff like that and then continue some post-processing after that without keeping the client waiting
[19:39:32] havenwood: regedit: Streaming is super easy in Rails: https://api.rubyonrails.org/classes/ActionController/Streaming.html
[19:44:33] havenwood: regedit: Another option is to use ActionCable. Here's an example: https://blog.jakewilkins.com/2017/08/25/building-something-besides-a-chat-app-with-actioncable/
[19:46:06] regedit: upload a 19.2 MB file, takes relatively no time, then server side store the file via carrierwave+fog to S3, but for whatever reason that stretches the request time out to about 20 sec!...
[19:46:45] havenwood: regedit: My friend and girlfriend had basically that same issue and wrote the article above about solving it with ActionCable.
[19:46:50] regedit: so i was hoping i can tell the browser "kthxbai" after the upload is complete, then continue with transfer to S3 after the client is done with the request
[19:47:18] havenwood: regedit: "My basic task was to allow a user to request a PDF which would be generated asynchronously and notify them when it was ready."
[19:47:44] regedit: girlfriend having issues with rails upload request time? where do i find such girlfriends please
[19:48:21] havenwood: regedit: I met her at RubyConf then again at Ruby in Hollywood, which she founded. ¯\_(ツ)_/¯
[19:49:28] havenwood: Linell: But on Heroku, and similar setups, there's a timeout after about 20 seconds.
[19:49:46] regedit: Linell: that's the thing tho... on heroku the uploaded file is ephemeral, i can only do something with it within the request time
[19:50:45] regedit: is it really not tho? i even tried exploring that possibilitiy and tried some tests, so far couldnt ever find the file on subsequent dyno processes...
[19:52:02] regedit: i don't mind in this case. this file upload is used rather rarely, if it fails the users dont care to just retry
[19:53:07] regedit: i tested uploading a file and writing it to Rails.root/public/tmp/something.wtvr , then try opening that file from Sidekiq. Always gets file not found
[19:55:05] havenwood: regedit: Actually, I think it was an earlier version of Rails 5 I used it with. I'm having a doubt now about 4.
[19:55:29] havenwood: regedit: My memory fails me. I remember using it with a previous Rails release. Now I'm thinking that was just an earlier Rails 5, but unsure.
[19:56:17] regedit: i see the stack is currently heroku-16, is that more ephemeral FS than upgraded stack?
[20:04:20] regedit: can't seem to find any particular such release notes... https://devcenter.heroku.com/articles/heroku-18-stack
[22:40:01] drale2k_: with STI, does it matter if you out a "has_many" or "has_one" relation on the parent or child?