blindMoe

Activity Graph

Page 1 of 2 | Next »

2019-07-03

[22:22:26] blindMoe: has joined #RubyOnRails
[22:23:32] blindMoe: Client Quit

2019-02-23

[04:21:49] blindMoe: Quit: KVIrc 5.0.0 Aria http://www.kvirc.net/

2019-02-22

[21:16:33] blindMoe: has joined #RubyOnRails
[21:35:41] blindMoe: Is there a standard way of dealing with user submitted string in regex that are not ASCII_8BIT? Seems like sending in a utf-8 string causes it to throw icompatible encoding errors. I can force the encoding and remove invalid characters but that kind of defeats the purpose of the check
[21:43:28] blindMoe: I think you are correct.. other way around
[21:43:55] blindMoe: /Blah Müller Blah/i =~ 128.chr
[21:43:59] blindMoe: that will cause the error I am seeing
[21:45:07] blindMoe: that snippet is essentially what the system is trying to run
[21:46:39] blindMoe: Encoding::UndefinedConversionError: "\x80" from ASCII-8BIT to UTF-8
[21:46:39] blindMoe: /Blah Müller Blah/i =~ 128.chr.encode(Encoding::UTF_8)
[21:48:48] blindMoe: havenwood: Sorry the actual code doesn't use 128.chr .. I was just using it as an example to create the type of character that causes the issue
[21:48:56] blindMoe: so it would be more like "\x80"
[21:52:17] blindMoe: a user enters in a keyword they want to search a string for, so the string in the regex comes from the database, the string on the right hand side comes from user input
[21:52:28] blindMoe: odd thing is... it is utf-8
[21:54:10] blindMoe: I'll see if I can get some more info from the user about what exactly it was they were trying to input

2019-02-13

[19:56:34] blindMoe: has joined #RubyOnRails
[20:17:34] blindMoe: Is there a good way for a class to know what other classes inherit from it?
[20:19:20] blindMoe: Ahh yes.. thank you very much
[22:34:31] blindMoe: Ping timeout: 244 seconds

2019-01-18

[18:35:14] blindMoe: has joined #ruby
[18:35:20] blindMoe: has joined #RubyOnRails
[19:08:26] blindMoe: Quit: KVIrc 5.0.0 Aria http://www.kvirc.net/

2018-11-14

[00:32:05] blindMoe: Ping timeout: 272 seconds

2018-11-13

[23:29:14] blindMoe: has joined #RubyOnRails
[23:29:32] blindMoe: Is it possible to .eager_load() a relation and specify a scope in AR? ( Rails 5.2)
[23:29:47] blindMoe: I can't seem to find anything on it but I need to unscope the relation

2018-09-12

[17:56:22] blindMoe: has joined #RubyOnRails
[17:57:30] blindMoe: Has anyone ran into an issue with send_early_hints from rspec tests when upgrade to rails 5.2? I can't seem to figure out what is happening since it says it is trying to call it on an OpenStruct yet the request object in the test is what is should be
[18:40:56] blindMoe: Ping timeout: 244 seconds

2018-08-30

[14:26:37] blindMoe: has joined #RubyOnRails
[14:27:10] blindMoe: Has anyone ran into issues with rspec not using fallback translations with locales and complaining of missing translations even though they exist in the default locale?
[14:32:27] blindMoe: We use faker and en is in my default locale
[14:33:24] blindMoe: @sylario I saw an article on manually setting the locale with faker and it having issues but did not see anything about it causing the fallbacks to stop working
[15:40:04] blindMoe: @sylario I think we might have the same issue. My spec tests are running code that switches the current locale and also uses Faker.
[15:40:19] blindMoe: Did you find a fix for yours?
[15:41:15] blindMoe: sylario: You mean in the initializer?
[15:41:51] blindMoe: I already have 'config.i18n.default_locale = :en' in my environment/test.rb but that doesn't seem to help
[16:12:34] blindMoe: Ping timeout: 240 seconds

2018-08-22

[16:14:21] blindMoe: has joined #RubyOnRails
[16:15:06] blindMoe: Can someone recommend a good way of passing data ( in this case query params ) down from a controller through multiple classes. It seems odd to be passing the query string params through method calls down 4 or 5 levels
[16:42:00] blindMoe: Quit: KVIrc 4.9.2 Aria http://www.kvirc.net/

2018-07-24

[21:07:03] blindMoe: has joined #RubyOnRails
[21:09:07] blindMoe: with rspec, when I am allowing a class to receive a function call and that same function is called with multiple different params, is it possible to have an assertion only check against specific arguments? Right now it will tell me that it expected to receive foo('bar') twice but received foo('asdf') 4 times and foo('bar') twice
[21:46:40] blindMoe: Quit: KVIrc 4.9.2 Aria http://www.kvirc.net/

2018-06-27

[15:28:06] blindMoe: has joined #RubyOnRails
[15:28:52] blindMoe: I am having an issue where rails is returning 304 responses from some of the requests but it is also returning data in the payload. Has anyone ran into this before? From what I understand when it returns a 304 there should be no message body
[15:30:12] blindMoe: using JBuilder to build the response message but figured Rails would know not to render anything if it is sending a 304
[16:31:05] blindMoe: Quit: KVIrc 4.9.2 Aria http://www.kvirc.net/

2018-02-02

[05:45:17] blindMoe: has joined #RubyOnRails
[05:45:38] blindMoe: Is it possible to do something like: https://gist.github.com/blindMoe/11c7aa3d1a090f1a66ab308d1cd5ed85 Basically doing a "or where" on a joined table
[05:56:08] blindMoe: regedit: depends on what you are doing.. I rarely restart my server while developing
[05:56:18] blindMoe: I run rails s or thin then code away
[05:59:03] blindMoe: yeah I would normally just reload sidekiq at that point
[05:59:17] blindMoe: not sure about setting up sidekiq to autoreload in development environment... never had to do it
[06:25:37] blindMoe: Ping timeout: 248 seconds
[18:00:07] blindMoe: has joined #RubyOnRails
[18:00:19] blindMoe: Is it possible check if a table is already joined in an active record query?
[18:04:02] blindMoe: or, is it possible to use .or() for a column on a relation?
[18:05:09] blindMoe: nice thank you
[18:05:15] blindMoe: forgot about .references
[23:30:21] blindMoe: Ping timeout: 264 seconds

2018-01-11

[00:22:49] blindMoe: Quit: KVIrc 4.9.2 Aria http://www.kvirc.net/
[04:16:04] blindMoe: has joined #RubyOnRails
[04:16:57] blindMoe: Anyone have experience with jsonapi-resources that can help me with callbacks? I want to grab the params data inside the before_update callback but can't seem to get it. Can only access @model and context
[06:44:22] blindMoe: Quit: KVIrc 4.9.2 Aria http://www.kvirc.net/

2018-01-10

[23:31:25] blindMoe: has joined #RubyOnRails
[23:32:50] blindMoe: with jsonapi-resources, I have a simple has_many through relation that I want to be able to update (employee has many locations through employee_locations ) but when I send the relationship data with an employee create or update I get a 'employee-locations - is invalid' 500 error returned from jsonapi-resource. Anyone ran into this situation before when updating many to many types of relationship

2018-01-04

[00:51:44] blindMoe: Ping timeout: 248 seconds
[01:02:33] blindMoe: has joined #ruby
[01:02:33] blindMoe: Changing host
[01:02:33] blindMoe: has joined #ruby
[01:08:26] blindMoe: Ping timeout: 260 seconds
[01:17:13] blindMoe: has joined #ruby
[01:17:14] blindMoe: has joined #ruby
[01:17:14] blindMoe: Changing host
[01:22:39] blindMoe: Ping timeout: 248 seconds
[01:24:15] blindMoe: has joined #ruby
[01:24:15] blindMoe: Changing host
[01:24:15] blindMoe: has joined #ruby
[23:26:28] blindMoe: Quit: KVIrc 4.9.2 Aria http://www.kvirc.net/

2018-01-03

[01:09:06] blindMoe: Quit: KVIrc 4.9.2 Aria http://www.kvirc.net/
[01:57:26] blindMoe: has joined #RubyOnRails
[01:58:15] blindMoe: So rubocop doesn't want us to use URI.escape() anymore ( rightfully so ) but I can't find a replacement that offers the ability to supply a regex for safe params like URI.escape does. Does someone have a suggestion?
[04:12:44] blindMoe: Quit: KVIrc 4.9.2 Aria http://www.kvirc.net/
[18:20:04] blindMoe: has joined #ruby
[18:20:46] blindMoe: Since the newer version of rubocop wants methods to be implicitly defined in controllers if they are used in an action filter, should I basically just be adding lines like: def show; super; end to appease rubocop?
[18:21:53] blindMoe: my controllers for my API all inherit from a main api_controller.rb which inherits from ActionController::Base so when I create a resource in the routes.rb I am not implicitly defining those methods.. yet rubocop wants me to
[18:45:06] blindMoe: Could really use some help on this? Also, I meant to say explicitly not implicitly
[18:48:29] blindMoe: c-c: yeah I don't like it.. I am actually just thinking of disabling that rubocop rails. Didn't realize this was a rails specific issue but I can see it not since it is inherting from ActionController::base and using its resource magic
[18:48:45] blindMoe: s/rubocop rails/rubocop rule/
[18:50:55] blindMoe: c-c: yeah unfortunately this is a new company I am working with and it isn't my choice... right now I am just updating rubocop from 0.42 to 0.52.1 and there are a ton of new rules
[21:06:41] blindMoe: Ping timeout: 248 seconds
[21:35:17] blindMoe: has joined #ruby
[21:35:17] blindMoe: Changing host
[21:35:17] blindMoe: has joined #ruby

2018-01-02

[18:16:53] blindMoe: has joined #RubyOnRails
[18:17:57] blindMoe: I am updating an older app from rubocop .42 to .52.1. One rule in rubocop-rspec that is bugging me is it wanting me to "paranthesize the param change". The line is this: expect { subject }.not_to change { user.emails.first.confirmed? }
[18:18:29] blindMoe: but when I switch it to expect { subject }.not_to change(user.emails.first.confirmed?) I end up getting an error because .confirmed? is nil in some of the tests ( it is part of a shared example )
[18:18:59] blindMoe: curious if maybe I am just mis-reading the rule description and am doing it wrong or if someone knows what needs to be done?
[22:18:52] blindMoe: Quit: KVIrc 4.9.2 Aria http://www.kvirc.net/
[23:31:17] blindMoe: has joined #RubyOnRails
[23:32:48] blindMoe: with a rails action controller, if I do something like before_action :foo only: [:index, :show] but index is not defined in this class, rubocop now wants me to define it. I can just do: def index; end but would should I be doing def index; super; end ?

2017-12-30

[18:18:09] blindMoe: has joined #RubyOnRails
[18:18:10] blindMoe: I'm having an issue where the new version of rubocop wants me to paranthesize this rspec line but if I switch it from a block to a method call and the param returns nil it throws a TypeError: expect { subject }.not_to change { user.emails.first.confirmed? }
[18:18:28] blindMoe: anyone have any suggestions to help me get it to pass rubocop?
[18:21:28] blindMoe: forgot to paste the rubocop error ;) You must pass an argument rather than a block to use the provided matcher (""), or the matcher must implement `supports_block_expectations?`.
[18:42:00] blindMoe: Is there a way to have rubocop spit out the current ruleset? I have an old app that I am updating to the newest version of rubocop and want to see what the old default settings were
[19:02:35] blindMoe: Ping timeout: 240 seconds

2017-12-27

[21:16:15] blindMoe: has joined #RubyOnRails
[21:16:58] blindMoe: Is there a way to get the hostname of the server that rails is running on? I would like to get what would normally be stored in request.host but since my app is proxied through another app it returns the host of the proxy app and not the server my app is running on
[21:22:49] blindMoe: fryguy: thanks I will
[21:23:50] blindMoe: fryguy: kinda closer but it isn't 100% fool proof.. I think I need to work more with the request that is being sent from the proxy
[21:29:37] blindMoe: amperry: I believe you have to put that attribute on the actual <form> tag instead of the input for some browsers to respect it. Chrome may be one of those browsers
[21:38:16] blindMoe: fryguy: looks like request.env['SERVER_NAME'] works in this case.. it returns the proper server hostname and not the proxy site's hostname like request.host does
[21:39:26] blindMoe: err sorry meant HTTP_HOST not SERVER_NAME .. although server name works in most instances as well
[23:01:33] blindMoe: Ping timeout: 264 seconds

2017-12-16

[06:35:02] blindMoe: has joined #ruby
[06:35:56] blindMoe: Spending time tonight upgrading rubocop on one of my apps and am running into an error where it says that this line should be delimited by `[` and `]`. I am not sure what it is asking for, anyone mind helping? %w(jpg jpeg gif png)
[06:37:24] blindMoe: seems like it wants %w[jpg jpeg gif png] but I have never used %w[ before
[08:47:27] blindMoe: Ping timeout: 248 seconds
[08:48:31] blindMoe: has joined #ruby
[08:48:31] blindMoe: Changing host
[08:48:31] blindMoe: has joined #ruby
[08:53:13] blindMoe: Ping timeout: 265 seconds
[08:57:59] blindMoe: has joined #ruby
[08:58:00] blindMoe: has joined #ruby
[08:58:00] blindMoe: Changing host
[09:28:32] blindMoe: Ping timeout: 248 seconds
[09:30:24] blindMoe: has joined #ruby
[09:30:24] blindMoe: Changing host
[09:30:24] blindMoe: has joined #ruby
[09:34:48] blindMoe: Ping timeout: 240 seconds
[10:09:36] blindMoe: has joined #ruby
[10:09:37] blindMoe: has joined #ruby
[10:09:37] blindMoe: Changing host
[10:15:27] blindMoe: Ping timeout: 248 seconds
[10:24:04] blindMoe: has joined #ruby
[10:24:04] blindMoe: Changing host
[10:24:04] blindMoe: has joined #ruby
[10:32:08] blindMoe: Ping timeout: 240 seconds
[11:01:38] blindMoe: has joined #ruby
[11:01:38] blindMoe: Changing host
[11:01:38] blindMoe: has joined #ruby
[11:06:08] blindMoe: Ping timeout: 240 seconds
[11:48:35] blindMoe: has joined #ruby
[11:48:35] blindMoe: Changing host
[11:48:35] blindMoe: has joined #ruby
[11:53:45] blindMoe: Ping timeout: 264 seconds
[12:25:02] blindMoe: has joined #ruby
[12:25:02] blindMoe: Changing host
[12:25:02] blindMoe: has joined #ruby
[12:29:28] blindMoe: Ping timeout: 240 seconds
[12:46:29] blindMoe: has joined #ruby
[12:46:29] blindMoe: Changing host
[12:46:29] blindMoe: has joined #ruby
[12:50:48] blindMoe: Ping timeout: 240 seconds
[14:21:08] blindMoe: has joined #ruby
[14:21:09] blindMoe: has joined #ruby
[14:21:09] blindMoe: Changing host
[14:28:47] blindMoe: Ping timeout: 248 seconds
[14:32:37] blindMoe: has joined #ruby
[14:32:37] blindMoe: Changing host
[14:32:37] blindMoe: has joined #ruby
[14:37:08] blindMoe: Ping timeout: 240 seconds
[15:16:48] blindMoe: has joined #ruby
[15:16:48] blindMoe: Changing host
[15:16:48] blindMoe: has joined #ruby
[15:21:20] blindMoe: Ping timeout: 265 seconds
[15:24:46] blindMoe: has joined #ruby
[15:24:46] blindMoe: Changing host
[15:24:46] blindMoe: has joined #ruby
[15:29:27] blindMoe: Ping timeout: 256 seconds
[16:16:35] blindMoe: has joined #ruby
[16:16:35] blindMoe: Changing host
[16:16:35] blindMoe: has joined #ruby
[16:21:51] blindMoe: Ping timeout: 260 seconds
[16:32:22] blindMoe: has joined #ruby
[16:32:22] blindMoe: Changing host
[16:32:22] blindMoe: has joined #ruby
[16:36:28] blindMoe: Ping timeout: 240 seconds
[17:00:38] blindMoe: has joined #ruby
[17:00:38] blindMoe: Changing host
[17:00:38] blindMoe: has joined #ruby
[17:29:29] blindMoe: Quit: KVIrc 4.9.2 Aria http://www.kvirc.net/

2017-12-01

[01:22:59] blindMoe: has joined #RubyOnRails
[01:23:27] blindMoe: Has anyone been able to setup a many to many relation in jsonapi-resource using through: ?
[01:24:08] blindMoe: When I set one up, I get errors when trying to filter.. instead of it searching for the column table_a.table_b.table_c_id it just does table_a.table_c_id
[14:50:52] blindMoe: Quit: KVIrc 4.9.2 Aria http://www.kvirc.net/
[17:53:44] blindMoe: has joined #RubyOnRails
[17:55:00] blindMoe: Does anyone know how to force a json api resource to always apply a join? I tried overriding self.apply_join() but it doesn't seem to do it ( unless I am doing it wrong ). https://gist.github.com/blindMoe/fd981d93cd2dae73d0ba9e53a76615d3
[17:56:01] blindMoe: the problem right now is that if filer[location] is not provided, the join is never created for the device_config table and when sorting by device_config.location.name it throws an error. If I add in the filter for location and the join is created, it works as expected
[21:25:33] blindMoe: Quit: KVIrc 4.9.2 Aria http://www.kvirc.net/

2017-11-30

[19:11:19] blindMoe: has joined #RubyOnRails
[19:12:16] blindMoe: Anyone with JSONAPI Resource experience know if it possible to specify a has_one :through relationship in the resource and be able to filter / sort by it? Right now it seems like jsonapi resource is not respecting the :through declaration
[19:12:29] blindMoe: the same relation is set in the actual model and works just fine
[22:36:45] blindMoe: Quit: KVIrc 4.9.2 Aria http://www.kvirc.net/

2017-11-29

[05:24:19] blindMoe: has joined #RubyOnRails
[05:24:33] blindMoe: Is is possible to manually set a model instance to invalid?
[06:41:36] blindMoe: Ping timeout: 248 seconds

2017-11-22

[18:01:42] blindMoe: has joined #RubyOnRails
[18:25:07] blindMoe: Quit: KVIrc 4.9.2 Aria http://www.kvirc.net/

2017-11-21

[01:34:27] blindMoe: Ping timeout: 240 seconds

2017-11-20

[22:43:04] blindMoe: has joined #RubyOnRails
[22:43:47] blindMoe: I have an api endpoint that gets hit and basically just returns some data stored in the session for that user. It works great in all browsers with the exception of Safari. In Safari session.id is always nil. Has anyone ran into this before? I am at a loss
[22:44:06] blindMoe: was wondering if maybe Safari was not storing cookies for some reason but I don't see any error in the console and the cookie exists
[22:45:05] blindMoe: hrmm actually it looks like the cookie is empty in safari
[22:45:12] blindMoe: no idea what would cause that
[22:48:24] blindMoe: arg I think it is because it is in an iframe.. wtf safari

2017-11-17

[01:49:47] blindMoe: has joined #RubyOnRails
[01:49:56] blindMoe: Is it possible to set a model as invalid w/o using a validator?
[08:02:56] blindMoe: Quit: KVIrc 4.9.2 Aria http://www.kvirc.net/

2017-10-25

[00:26:38] blindMoe: has joined #RubyOnRails
[00:26:49] blindMoe: What is the proper way to return results for a model only if it has a specific relation set?
[00:27:20] blindMoe: the table I am querying agains has a ton of records so I want to try and do it as efficiently as possible ( a ton = 100,000,000+ )
[00:29:10] blindMoe: Right now I am doing Foo.joins(:bar).group('bar.id') but not sure if there is a better way
[00:37:47] blindMoe: fryguy: nah because bar contains foo_id ( relation goes the other way )
[00:39:42] blindMoe: I want to return all records of Foo that have a Bar set
[00:41:19] blindMoe: I am sure that would work butI am wondering if it is more efficient
[00:41:35] blindMoe: curious about the response times of the query since it is an api call
[01:23:25] blindMoe: Quit: KVIrc 4.9.2 Aria http://www.kvirc.net/

2017-09-26

2017-09-25

[22:34:40] blindMoe: has joined #ruby
[22:34:40] blindMoe: Changing host
[22:34:40] blindMoe: has joined #ruby
[22:34:44] blindMoe: has joined #RubyOnRails
[22:36:50] blindMoe: When saving a date to the db ( postgres timestamp ) using AR is is possible to have it not convert it to UTC? I am trying to make it so certain rake tasks run at midnight for locations we have stored in the db but midnight is different for many of the locations due to the timezones
[22:38:02] blindMoe: so I can do something like run_task_at DateTime.tomorrow.beginning_of_day.in_time_zone(location.time_zone) and it returns the correct time (Mon, 25 Sep 2017 20:00:00 EDT -04:00) for what I want but when I save it to the db it saves it at 9/26/2017 00:00:00
[22:40:17] blindMoe: mwlang: it is set
[22:42:58] blindMoe: mwlang: The problem is that this app can run in a cluster and the timezone could be dynamic

2017-09-14

[20:39:58] blindMoe: has joined #ruby

2017-09-01

[06:23:15] blindMoe: has joined #RubyOnRails
[06:24:29] blindMoe: I am using paper_trail to store audit logs and have it setup with the object column as type jsonb. When I run rspec to test the audit log it seems that it returns the .object field as a string and not a hash. Anyone have any pointers as to what I should check to see why it would do that?
[06:38:17] blindMoe: matthewd: paper_trail handles that and the serializer is set to a json serializer
[06:38:36] blindMoe: it is just odd that it only seems to do it when RAILS_ENV is test
[06:50:39] blindMoe: Ping timeout: 248 seconds

2017-08-08

[00:50:40] blindMoe: has joined #ruby
[00:55:42] blindMoe: Ping timeout: 260 seconds
[05:31:06] blindMoe: has joined #ruby
[05:35:55] blindMoe: Ping timeout: 255 seconds
[09:22:07] blindMoe: has joined #ruby
[09:27:37] blindMoe: Ping timeout: 276 seconds
[16:51:38] blindMoe: has joined #ruby
[17:12:12] blindMoe: Ping timeout: 260 seconds