openstruct

Activity Graph

Page 1 of 2 | Next »

2019-07-16

[16:11:37] openstruct: has joined #ruby
[16:13:00] openstruct: I've been reading through all the "don't use Ruby timeout" blog posts and I'm not sure how I see that it's unsafe if I'm explicitly rescuing Timeout::Error every time I use it?
[16:13:56] openstruct: Is it still problematic because it can cause a client from a connection pool to be corrupted?
[18:40:19] openstruct: Quit: WeeChat 2.4

2018-12-06

[01:26:42] openstruct: has joined #RubyOnRails

2018-11-24

[01:42:40] openstruct: Quit: Page closed

2018-11-23

[19:02:08] openstruct: has joined #RubyOnRails
[19:06:07] openstruct: I'm trying to debug sporadic "MySQL server has gone away errors" occurring with a Rails app with Unicorn. I've already dug into the common causes of that error per the MySQL docs, but I suspect that a mysql thread is getting hung up and unicorn may be checking that thread out, but I'm not sure how to verify this?
[19:06:46] openstruct: Is there a good way to log/output the thread id being used by a worker at any given time?
[19:14:16] openstruct: I suppose I can log out ActiveRecord::Base.connection_pool.stat and if the size ever equals 2 and dead is 0 then I can verify that this is the case. Or I could limit the db pool to 1, but then I'd need to ensure I'm reconnecting whatever causes the connections to die.

2018-10-24

[02:01:02] openstruct: has joined #ruby
[02:11:21] openstruct: I'm in a situation where I need to use two versions of the elasticsearch gem to write to two instances of elasticsearch that are different versions. Is my best bet to fork the gem and rename it to something else so that I can use them both?
[02:58:15] openstruct: lupine: Was mostly a temporary idea while I do the upgrade, but I'm an hour into renaming elasticsearch and it is quite messy.
[02:58:57] openstruct: I suppose I could have two processes running...
[03:10:17] openstruct: Ping timeout: 256 seconds

2018-10-03

[15:03:10] openstruct: has joined #ruby
[15:07:04] openstruct: Quit: Page closed

2018-07-17

[00:49:57] openstruct: has joined #ruby
[00:52:12] openstruct: Been debugging a stack level too deep error for the past few days and am out of debugging ideas. I've got a service object that works perfectly when run via the console, but raises the stack error when delayed with sidekiq. In particular, it works with #perform but not with #perform_async.
[00:53:44] openstruct: AFAIK sidekiq uses a normal ruby process, but I can't determine why that process can't handle the work.
[00:56:02] openstruct: Hmm might be related to celluloid.
[01:01:25] openstruct: mistergibson: Not intentionally, but the sidekiq version I have does. Upgrading to the latest sidekiq again to see if that's the case.
[01:02:34] openstruct: mistergibson: Just upgraded to the latest version that no longer users celluloid, but alas the error remains.
[01:03:20] openstruct: Thanks for the suggestion though!
[04:30:56] openstruct: Might be able to use pdftk to fill out PDF that has form elements. I think there's a ruby wrapper for it out there.
[05:28:06] openstruct: Ping timeout: 252 seconds

2018-07-09

[18:38:57] openstruct: has joined #RubyOnRails
[18:42:29] openstruct: Been digging around the ActiveStorage code, but I can't determine if it has built-in protection from SSRF. When using Paperclip, I used private_address_check to ensure a user-submitted URL doesn't resolve to a private address. Should I be doing the same check before passing urls to active storage?
[19:55:03] openstruct: Quit: Page closed

2018-05-03

[21:17:04] openstruct: has joined #RubyOnRails
[21:19:00] openstruct: I've been building a lot of dashboards recently that manage multiple resources and have been wrestling with the best way to handle CRUD actions. For example, given a product dashboard that manages cameras, lens, and tripods, should the ProductDashboardController handle the CRUD operations or should the individual resource controllers handle those? It seems like the individual resource controllers should be responsible instead
[21:35:24] openstruct: Yeah, that's what I feel like it's most appropriate to have the dashboard forms call to their respective endpoints.
[22:10:04] openstruct: The only part that feels hairy to me is handling redirects and errors, but that's just because the front-end of this app isn't fleshed out to handle those. I think once I get it nailed down, it should be pretty easy to write dashboards on dashboards on dashboards.
[22:10:44] openstruct: Also, those are neat endpoints.
[22:56:09] openstruct: Quit: Page closed

2018-04-11

[16:53:00] openstruct: has joined #ruby

2018-03-28

[22:20:26] openstruct: has joined #RubyOnRails
[22:23:48] openstruct: Recently, I refactored a query in an app that was incredibly slow. While it's now faster, it appears that I've somehow managed to introduce a memory leak, but don't understand how it's possible. https://pastebin.com/AtKNbL4u
[22:24:44] openstruct: For background, the exact same data structure is returned (an array of hashes) and overtime I see Ruby's heap grow due to this query and it looks like the GC isn't clearing out old references.
[23:55:42] openstruct: Quit: Page closed

2018-02-08

[02:00:17] openstruct: has joined #RubyOnRails
[02:09:07] openstruct: Quit: Page closed

2018-01-19

[00:55:16] openstruct: has joined #RubyOnRails
[01:12:38] openstruct: I'm working on writing a custom coder to play with ActiveRecord::Store. Essentially, I have a jsonb column defaulted to {} and I want to merge it with default values on load/dump. However, the IndifferentCoder always passes an empty string before passing the attribute and I can't figure out why. https://github.com/rails/rails/blob/99820fbeb29ae35a7771f3991bd119b102861aa7/activerecord/lib/active_record/store.rb#L194
[01:13:56] openstruct: The YAML and JSON coders provided have guard clauses for #blank? which I can add, but in my case {} also responds to blank. I can always check the type, but that seems odd to do here.
[01:16:18] openstruct: Actually, the YAML coder does type checking. I suppose I'll do the same ¯\_(ツ)_/¯
[03:44:02] openstruct: Quit: Page closed

2018-01-17

[23:09:09] openstruct: has joined #RubyOnRails
[23:12:17] openstruct: Is it possible to the built in form helpers for json fields? I've got a simple object of preferences like {preference_1: true, preference_2: false} and am trying to create checkboxes for them. I know I can manually create them, but I can't seem to wrangle the helpers.
[23:12:35] openstruct: *possible to use
[23:45:25] openstruct: Ping timeout: 260 seconds

2017-09-18

[22:51:58] openstruct: has joined #RubyOnRails
[23:01:11] openstruct: Quit: Page closed

2017-09-01

[16:56:30] openstruct: has joined #RubyOnRails
[17:09:43] openstruct: Quit: Page closed
[21:18:15] openstruct: has joined #RubyOnRails
[21:20:41] openstruct: I'm working on a service to upload User data to an API. I need to construct a CSV that's specific to this API and figured that a Gateway object might be the best route to do that since it's outside the scope of the User model. Is there a better convention for this task?
[23:59:17] openstruct: Quit: Page closed

2016-07-29

[17:57:15] openstruct: has joined #RubyOnRails
[17:57:15] openstruct: has joined #ruby

2016-07-28

[02:44:56] openstruct: has joined #RubyOnRails
[02:44:56] openstruct: has joined #ruby
[04:16:59] openstruct: Remote host closed the connection
[04:17:36] openstruct: has joined #RubyOnRails
[04:17:36] openstruct: has joined #ruby
[04:22:06] openstruct: Ping timeout: 250 seconds
[10:21:29] openstruct: has joined #RubyOnRails
[10:21:29] openstruct: has joined #ruby

2016-07-27

[10:25:15] openstruct: has joined #RubyOnRails
[10:25:15] openstruct: has joined #ruby
[10:31:06] openstruct: Is it a horrible idea to write a rails engine with version 5 with the hopes of mounting it on an rails 4.2 app?
[10:34:11] openstruct: workmad3: I'm mostly just using the --api mode.
[10:34:36] openstruct: With the jsonapi-resources gem (beta, playing on that bleeding age. weeeeee)
[10:35:40] openstruct: sevenseacat: I semi wish I has stayed with AMS. Thought it'd be faster but namespacing with en engine and versioned api has been absolute hell.
[10:36:13] openstruct: workmad3: Good to know...I foresee some late nights ahead.
[10:37:19] openstruct: workmad3: We're hoping to upgrade the app to 5 in the near future, that's the main reason.
[10:39:16] openstruct: workmad3: I like the idea of implementing it as an engine as we plan on moving it out once we get past the MVP stage. Granted, I can just upgrade as you said.
[10:39:26] openstruct: Bleh, time to downgrade the engine.
[10:41:27] openstruct: workmad3: Well, now I'm torn. I need to get some coffee :)
[10:43:22] openstruct: I thought I was being clever with the engine idea. But now I feel the many pains.
[10:49:28] openstruct: workmad3: I'd argue that in this case, I know the scope of the feature. I wasn't able to get my team on board with making a separate app since we're at MVP stage and we didn't want to deal with syncing across services. This seemed liked the best way to keep the logic completely decoupled. Granted, I understand your logic here.
[10:49:49] openstruct: haha yes, it has been a major source of pain.
[10:50:11] openstruct: workmad3: You're right, that changed a lot.
[10:50:31] openstruct: If only I was that person that had it all in their head at the beginning :)
[10:51:44] openstruct: workmad3: I appreciate the wisdom, thanks for the help!
[11:18:49] openstruct: Remote host closed the connection
[11:40:41] openstruct: has joined #RubyOnRails
[11:40:41] openstruct: has joined #ruby

2016-07-24

[13:39:56] openstruct: has joined #RubyOnRails
[13:39:56] openstruct: has joined #ruby
[13:45:16] openstruct: Ping timeout: 252 seconds

2016-07-23

[19:44:46] openstruct: has joined #RubyOnRails
[19:44:46] openstruct: has joined #ruby
[19:46:34] openstruct: I'm using active_model_serializer and want to return a JSON object that pulls bits of data from 4 different models...anyone have suggestions on how to best do this?
[19:47:25] openstruct: So that's where it gets a little hairy
[19:47:56] openstruct: I guess my issue is, I only want pieces of each model and it feels odd to change all the serializers to cater to this one endpoint.
[19:48:23] openstruct: Maybe I should make a PORO and serialize that?
[19:48:33] openstruct: But I still need ActiveModel, heh.
[19:49:33] openstruct: Yeah, that's an option for sure! I figured I'd make a new MyObjectSummarySerializer and specify the attributes almost like a presenter.
[19:50:59] openstruct: Could also specify specific serializers for each association.
[19:51:13] openstruct: Part of me thinks I'm abusing AMS
[19:54:26] openstruct: Two belongs_to and a single has_one, but I only need specific data from each thing. It's a bit "graphy" where I'm trying to summarize a user's activity. Looks like I can add scopes to associations though, which will do wonders.
[19:59:06] openstruct: sumobob: Just in case this helps you - I used `ActiveModelSerializers::SerializableResource.new(MyModel, serializer: MyModelSummarySerializer).as_json`
[19:59:53] openstruct: By specifying this new serializer, I just made methods to grab the data I want from each association. I think it's still JSON API compliant, too.
[20:00:59] openstruct: Yup - I actually didn't even specify the associations just did stuff like `object.articles.most_recent.title`. Again, not sure if this is going against what AMS stands for.
[20:09:47] openstruct: Can't you override the controller method for whichever action?
[20:22:29] openstruct: Remote host closed the connection

2016-07-22

[13:19:26] openstruct: has joined #RubyOnRails
[13:19:26] openstruct: has joined #ruby
[13:20:39] openstruct: This might be obvious...I'm implementing a Rails engine and for rails app to mount it, I assume both the engine and the app need to be on the same version of Rails?
[13:21:08] openstruct: *implementing a Rails engine to be mounted on another Rails app,
[13:22:59] openstruct: That makes sense - best bet would be to hit the changelogs and look for breaking changes?
[13:23:18] openstruct: Or I bet I could add various dummy apps in the engine specs with different Rails versions.
[16:56:25] openstruct: has joined #RubyOnRails
[16:56:25] openstruct: has joined #ruby
[17:22:24] openstruct: has joined #RubyOnRails
[17:22:24] openstruct: has joined #ruby
[17:31:26] openstruct: I'm a bit confused on how to work with models in a rails engine and their associations when a mounting app might have similar models. Basic example - https://gist.github.com/anonymous/3ec27b50fd624c2d71df8359fc5731d1
[17:35:01] openstruct: I'm under the impression that the models within a rails engine need to have the class_name specified to keep the relations strict.
[17:39:09] openstruct: arup_r: Yeah
[17:40:13] openstruct: I was just surprised that I could assign a normal User to the MyEngine::Article. I figured it'd only accept MyEngine::User
[17:41:39] openstruct: arup_r: I'm tempting to specify class_name for all my engine models just to prevent others from attempting to do something similar.
[17:42:39] openstruct: True but the foreign_keys don't include the engine prefix...at least not in the railsguide
[17:43:22] openstruct: MyEngine::Article (my_engine_article) would have user_id instead of (my_engine_user)...which also surprised me :)
[17:44:40] openstruct: True. Thanks for helping me check my sanity.

2016-07-21

[18:13:22] openstruct: has joined #RubyOnRails
[18:13:22] openstruct: has joined #ruby
[18:17:43] openstruct: Might be the wrong place for this, but I'm using Devise with omniauth-github. If I wanted to make authorized requests on the user's behalf, I should get an access token separately than the one that omniauth-github returns, right?

2016-07-06

[00:24:34] openstruct: has joined #RubyOnRails
[00:24:34] openstruct: has joined #ruby

2016-07-05

[14:23:06] openstruct: has joined #RubyOnRails
[14:23:06] openstruct: has joined #ruby
[14:24:13] openstruct: Without knowing C, are there any ways to determine the big O notation of methods like Enumerable#select?
[14:25:19] openstruct: Oh, should've checked that first.
[14:27:55] openstruct: Can always count on Chuck Norris to be consistent.
[14:31:39] openstruct: Ruh roh, are we not agreeing on common sense?
[14:34:11] openstruct: I believe quick sort's worst-case is n log(n)
[14:34:47] openstruct: Oh, I was thinking of mergesort.
[14:35:42] openstruct: Wonder if it's best to avoid sugary methods when developing algorithms with Ruby in the event I can't confidently state the big o
[14:40:46] openstruct: Sure - I suppose I was just worried that it may do something unexpected. I imagine I can make safe space complexity assumptions as well?
[21:24:50] openstruct: Remote host closed the connection
[21:30:28] openstruct: has joined #RubyOnRails
[21:30:28] openstruct: has joined #ruby

2016-07-04

[01:24:36] openstruct: has joined #RubyOnRails
[01:24:36] openstruct: has joined #ruby
[01:25:14] openstruct: Are there any resources for looking up the big O notation for ruby core methods? (e.g. Enumerable#min)
[02:02:28] openstruct: Remote host closed the connection
[02:03:43] openstruct: has joined #RubyOnRails
[02:03:43] openstruct: has joined #ruby

2016-06-06

[14:13:29] openstruct: has joined #RubyOnRails
[14:13:29] openstruct: has joined #ruby

2016-05-31

[15:25:47] openstruct: has joined #RubyOnRails
[15:25:47] openstruct: has joined #ruby

2016-05-12

[03:01:26] openstruct: has joined #ruby
[03:01:27] openstruct: has joined #RubyOnRails
[13:34:49] openstruct: has joined #RubyOnRails
[13:34:49] openstruct: has joined #ruby

2016-05-10

[15:29:53] openstruct: has joined #RubyOnRails
[15:29:53] openstruct: has joined #ruby
[21:14:38] openstruct: Remote host closed the connection
[22:49:41] openstruct: has joined #RubyOnRails
[22:49:41] openstruct: has joined #ruby
[22:54:40] openstruct: Ping timeout: 265 seconds
[23:00:49] openstruct: has joined #RubyOnRails
[23:00:49] openstruct: has joined #ruby

2016-05-05

[17:02:31] openstruct: has joined #RubyOnRails
[17:02:31] openstruct: has joined #ruby

2016-05-04

[14:10:31] openstruct: has joined #RubyOnRails
[14:10:31] openstruct: has joined #ruby

2016-05-03

[14:46:09] openstruct: has joined #ruby
[14:46:10] openstruct: has joined #RubyOnRails
[17:13:03] openstruct: has joined #RubyOnRails
[17:13:03] openstruct: has joined #ruby

2016-05-02

[14:19:52] openstruct: has joined #RubyOnRails
[14:19:52] openstruct: has joined #ruby

2016-04-19

[15:42:08] openstruct: has joined #ruby
[15:42:09] openstruct: has joined #RubyOnRails

2016-04-13

[14:19:16] openstruct: has joined #RubyOnRails
[14:19:16] openstruct: has joined #ruby

2016-04-08

[13:13:53] openstruct: has joined #RubyOnRails
[13:13:53] openstruct: has joined #ruby

2016-03-31

[14:05:40] openstruct: has joined #RubyOnRails
[14:05:40] openstruct: has joined #ruby

2016-03-25

[20:44:37] openstruct: has joined #RubyOnRails
[20:44:37] openstruct: has joined #ruby

2016-03-23

[13:11:04] openstruct: has joined #RubyOnRails
[13:11:04] openstruct: has joined #ruby

2016-03-21

[17:28:48] openstruct: has joined #RubyOnRails
[17:28:48] openstruct: has joined #ruby

2016-03-17

[18:11:09] openstruct: has joined #RubyOnRails
[18:11:09] openstruct: has joined #ruby

2016-03-15

[15:11:14] openstruct: has joined #RubyOnRails
[15:11:14] openstruct: has joined #ruby

2016-03-10

[12:38:54] openstruct: has joined #RubyOnRails
[12:38:54] openstruct: has joined #ruby

2016-03-09

[15:12:49] openstruct: has joined #RubyOnRails
[15:12:49] openstruct: has joined #ruby
[21:07:57] openstruct: Remote host closed the connection
[21:09:23] openstruct: has joined #RubyOnRails
[21:09:23] openstruct: has joined #ruby
[21:13:44] openstruct: Ping timeout: 244 seconds

2016-03-08

[11:36:42] openstruct: has joined #RubyOnRails
[11:36:42] openstruct: has joined #ruby
[15:01:25] openstruct: Remote host closed the connection
[15:48:44] openstruct: has joined #RubyOnRails
[15:48:44] openstruct: has joined #ruby
[19:48:20] openstruct: has joined #RubyOnRails
[19:48:20] openstruct: has joined #ruby
[20:10:06] openstruct: Ping timeout: 248 seconds

2016-03-07

[22:08:41] openstruct: has joined #ruby
[22:08:42] openstruct: has joined #RubyOnRails
[22:22:02] openstruct: Remote host closed the connection
[22:23:56] openstruct: has joined #RubyOnRails
[22:23:56] openstruct: has joined #ruby
[22:28:17] openstruct: Ping timeout: 244 seconds