« Back to channel list

#RubyOnRails - 10 September 2018

« Back 1 day Forward 1 day »
[00:56:36] Technodrome: has joined #RubyOnRails
[01:08:17] ariedler: has joined #RubyOnRails
[01:27:32] segy: has joined #RubyOnRails
[01:30:12] fragamus: has joined #RubyOnRails
[01:31:59] timdotrb: has joined #RubyOnRails
[01:32:02] timdotrb: Evening, all
[01:33:03] timdotrb: I'm storing some numbers as strings to make them easier to work with, however, I've run into a problem. I'm trying to select the biggest number in the last 30 days, but bot .maximum() and doing raw SQL is giving me a number that starts with 9 - even though that is technically the smallest number
[01:34:10] timdotrb: Since the maximum method is giving me the wrong value, and order by is giving me the wrong number, any ideas how can I get the right one?
[01:34:49] aesthetikx: make sure postgres is sorting as numbers and not alphanumeric
[01:35:01] timdotrb: Sorry, I'm using MySQL
[01:35:02] aesthetikx: there is some way to tell it to treat strings as naturalnumbers
[01:36:26] bonhoeffer: has joined #RubyOnRails
[01:44:41] LiftLeft2: has joined #RubyOnRails
[01:46:02] LiftLeft3: has joined #RubyOnRails
[01:53:59] timdotrb: aesthetikx, got it. MySQL has a cast() function so I used that inside of the min() and max() function
[02:01:58] sevenseacat: has joined #RubyOnRails
[02:03:03] fragamus: has joined #RubyOnRails
[02:23:22] Saukk: has joined #RubyOnRails
[02:23:28] kotepillar_: has joined #RubyOnRails
[02:27:52] bonhoeffer: has joined #RubyOnRails
[02:30:12] bonhoeffer: has joined #RubyOnRails
[02:42:19] bonhoeffer: has joined #RubyOnRails
[03:09:00] braincrash: has joined #RubyOnRails
[03:14:00] Dimik: has joined #RubyOnRails
[03:40:22] srinidhi: has joined #RubyOnRails
[03:59:46] chouhoulis: has joined #RubyOnRails
[04:10:26] kotepillar_: has joined #RubyOnRails
[04:21:20] FastJack: has joined #RubyOnRails
[04:23:26] fragamus: has joined #RubyOnRails
[04:30:26] reber: has joined #RubyOnRails
[05:17:22] orbyt_: has joined #RubyOnRails
[05:27:32] Technodrome: has joined #RubyOnRails
[05:34:17] apeiros: has joined #RubyOnRails
[05:36:48] orbyt_: has joined #RubyOnRails
[05:36:52] nemesit: has joined #RubyOnRails
[05:52:45] brandoncc: has joined #RubyOnRails
[05:59:16] dionysus69: has joined #RubyOnRails
[06:20:00] orbyt_: has joined #RubyOnRails
[06:32:14] morfin60: has joined #RubyOnRails
[06:32:41] morfin60: Is there any way to get DIRECT link to thing uploaded via Active Storage?
[06:32:53] morfin60: instead of going trought application?
[06:52:13] lomex: has joined #RubyOnRails
[07:07:28] fragamus: has joined #RubyOnRails
[07:27:53] dionysus69: so I have this migration and I am trying to reference same Currency table separately with buy_currency and sell_currency, all I am unable to do is the indexing part http://paste.debian.net/1041615/
[07:28:15] dionysus69: so I wonder how would you index this ?
[07:29:13] dionysus69: then I have this in model for each relation: belongs_to :sell_currency, class_name: "Currency"
[07:45:21] mikecmpbll: has joined #RubyOnRails
[08:00:20] lexileo: has joined #RubyOnRails
[08:07:14] Guest58115: has joined #RubyOnRails
[08:10:31] MoritaShinobu: has joined #RubyOnRails
[08:11:23] jottr: has joined #RubyOnRails
[08:14:15] lomex: has joined #RubyOnRails
[08:20:54] orbyt_: has joined #RubyOnRails
[08:47:58] uksio: has joined #RubyOnRails
[09:00:58] jenenliu: has joined #RubyOnRails
[09:03:46] andywww: has joined #RubyOnRails
[09:06:11] andywww: What is the Registration/DNS equivalent of what LetsEncrypt is to SSL certs please?
[09:06:56] andywww: do we still have to go through all these scabby commercial vendors with their control panels or is there a good community driven and/or open source one?
[09:10:09] mikecmpbll: has joined #RubyOnRails
[09:36:28] kapil___: has joined #RubyOnRails
[09:38:19] sevenseacat: you have to buy domains through a registrar, yes
[09:40:10] sevenseacat: after that, what you do with it is up to you
[10:04:23] brotspinne: has joined #RubyOnRails
[10:06:16] brotspinne: hey everyone. I have some weird problem with timezones in rails. when I assign a DateTime to a model's datetime attribute and then read that attribute again, I always have that weird timezone: LMT +00:53
[10:06:28] brotspinne: and it's always 53 minutes. what could this be?
[10:06:41] sevenseacat: can you show us some of your code?
[10:08:06] brotspinne: https://gist.github.com/pseidemann/2795924948b7ea3f11ceedceb12bd835
[10:08:15] brotspinne: this is inside the rails console
[10:08:43] brotspinne: the data type of that model's attribute is datetime
[10:09:47] sevenseacat: what timezone is your app set to?
[10:10:03] brotspinne: in application.rb I have config.time_zone = 'Berlin'
[10:14:29] orbyt_: has joined #RubyOnRails
[10:15:55] sevenseacat: thats what I thought - I googled it and am seeing issues with python's tz library, but nothing for ruby
[10:16:48] sevenseacat: apparently that used to be germany's timezone until 1893!
[10:16:51] brotspinne: when I read the timezone set in mysql I get CEST, not sure if this could cause any problems. I would expect the actual storage format to be utc and CEST is just for display
[10:17:10] sevenseacat: https://www.postgresql.org/message-id/OFD3976F87.F787752A-ONC1257B67.00473B00-C1257B67.00482D32%40ppi.de
[10:18:04] brotspinne: heh indeed if I use a date after that time the timezone is correct
[10:18:24] brotspinne: so I probably should fix our test dates to be in a proper year
[10:18:47] brotspinne: thanks that solved the mystery
[10:25:34] jenenliu: has joined #RubyOnRails
[10:35:58] jenenliu: has joined #RubyOnRails
[10:38:09] tekk: has joined #RubyOnRails
[10:53:50] lankanmon: has joined #RubyOnRails
[11:05:37] bonhoeffer: has joined #RubyOnRails
[11:05:40] sevenseacat: has joined #RubyOnRails
[11:09:33] kotepillar_: has joined #RubyOnRails
[11:34:22] bonhoeffer: has joined #RubyOnRails
[11:51:14] jottr: has joined #RubyOnRails
[11:55:54] pavelz: has joined #RubyOnRails
[11:56:36] pavelz: hi guys , wonder how can I find where a method defined in a class, because it is defined but it is not defined in the controller files
[12:07:01] mikecmpb_: has joined #RubyOnRails
[12:10:36] mauro1254: has joined #RubyOnRails
[12:25:29] tbuehlmann: pavelz: when using pry, you could call `$ some_object.some_method` and it will hopefully print some useful information
[12:30:37] bonhoeffer: has joined #RubyOnRails
[12:37:30] pavelz: can there be a round and no method at the end I wonder
[12:49:27] cpinto: has joined #RubyOnRails
[12:49:33] fragamus: has joined #RubyOnRails
[12:50:48] pavelz: i guess there is n't
[12:52:39] cpinto: hi all. I'm new to Rails and am trying to understand how to achieve the following: an app has the following models: Client, Job, Message. Job and Message use ActiveStorage for attachments. In the database I can see that the attachment table has a polymorphic association with Job and Message records. Is there an efficient way to get a list of all files (indirectly) related with the client model in Rails?
[12:54:40] cpinto: forgot to mention that Job and Message also have associations with Client
[13:11:53] afterglow94: has joined #RubyOnRails
[13:12:45] afterglow94: hey guys. new to RoR here. just wondering, how do I create a link to delete a specific image (that was uploaded via active storage)? I can't seem to find any resources on this.
[13:28:06] jottr: has joined #RubyOnRails
[13:48:04] bonhoeffer: has joined #RubyOnRails
[13:57:43] fragamus: has joined #RubyOnRails
[14:10:00] Saukk: has joined #RubyOnRails
[14:14:45] DTZUZO: has joined #RubyOnRails
[14:17:13] lessless_: has joined #RubyOnRails
[14:20:04] lessless_: I've added //=require jquery.pjax to application.js but still getting Sprockets::FileNotFound for it
[14:20:51] lessless_: also pjax_rails gem doesn't appear in the paths list as /Users/lessless/.rbenv/versions/2.3.6/lib/ruby/gems/2.3.0/gems/jquery-timepicker-rails-1.11.10/vendor/assets/javascripts for example
[14:23:36] wojnar: has joined #RubyOnRails
[14:29:01] kotepillar_: has joined #RubyOnRails
[14:49:02] jottr: has joined #RubyOnRails
[14:52:59] dblessing: has joined #RubyOnRails
[14:53:35] Puffball: has joined #RubyOnRails
[15:08:05] desperek: has joined #RubyOnRails
[15:08:54] bonhoeffer: has joined #RubyOnRails
[15:10:21] NL3limin4t0r: has joined #RubyOnRails
[15:10:51] conta1: has joined #RubyOnRails
[15:15:47] cpinto: has left #RubyOnRails: ()
[15:16:16] psychoslave_: has joined #RubyOnRails
[15:16:47] Technodrome: has joined #RubyOnRails
[15:18:40] krawchyk: has joined #RubyOnRails
[15:19:20] kapil___: has joined #RubyOnRails
[15:27:49] psychoslave: has joined #RubyOnRails
[15:29:58] psychoslave_: has joined #RubyOnRails
[15:49:42] kotepillar_: has joined #RubyOnRails
[16:01:00] apeiros_: has joined #RubyOnRails
[16:02:39] kotepillar_: has joined #RubyOnRails
[16:05:59] brandoncc: has joined #RubyOnRails
[16:10:22] beholders_eye: has joined #RubyOnRails
[16:11:40] cagomez: has joined #RubyOnRails
[16:13:04] machinewar: has joined #RubyOnRails
[16:13:16] machinewar: is there any way to change the join model used by a has_many through at runtime
[16:13:39] machinewar: so I want to pretty much check a column value and if its true use one join model and if its false use another join model
[16:24:19] Technodrome: has joined #RubyOnRails
[16:29:34] dblessing: has joined #RubyOnRails
[16:30:11] bonhoeffer: has joined #RubyOnRails
[16:47:35] DTZUZO: has joined #RubyOnRails
[16:56:26] prettybTech: has joined #RubyOnRails
[16:59:08] prettybTech: has joined #RubyOnRails
[17:06:28] GodFather: has joined #RubyOnRails
[17:14:42] dionysus69: has joined #RubyOnRails
[17:27:56] Technodrome: has joined #RubyOnRails
[17:31:34] sameerynho: has joined #RubyOnRails
[17:34:53] Linuus: has joined #RubyOnRails
[17:35:27] eckhardt_: has joined #RubyOnRails
[17:37:28] samort7: has joined #RubyOnRails
[17:37:45] blackbaba: has joined #RubyOnRails
[17:42:26] eckhardt_: has joined #RubyOnRails
[17:44:33] cpruitt: has joined #RubyOnRails
[17:50:44] eckhardt_: has joined #RubyOnRails
[18:06:00] cpruitt: Hopefully a quick question. I'm receiving a string representing a date/time from a remote server. The string does not include time zone info but always represents US Eastern. Example: "2018-1-1T17:37:48.357". I'm looking for the cleanest way to parse this string into a instance of TimeWithZone with the time correctly converted to UTC
[18:06:53] fragamus: has joined #RubyOnRails
[18:07:50] cpruitt: Actually, Nevermind. What I thought wasn't working seems to be working for me.
[18:12:04] sonOfRa: has joined #RubyOnRails
[18:14:56] tubbo: has joined #RubyOnRails
[18:17:57] Linuus: has joined #RubyOnRails
[18:20:24] defsdoor: has joined #RubyOnRails
[18:21:09] beholders_eye: has joined #RubyOnRails
[18:21:41] mangold: has joined #RubyOnRails
[18:29:56] blackmesa: has joined #RubyOnRails
[18:38:55] [Butch]: has joined #RubyOnRails
[18:39:27] chouhoulis: has joined #RubyOnRails
[18:47:31] chouhoulis: has joined #RubyOnRails
[19:08:05] dviola: has joined #RubyOnRails
[19:10:09] chouhoulis: has joined #RubyOnRails
[19:13:16] bonhoeffer: has joined #RubyOnRails
[19:14:01] prettybTech: has joined #RubyOnRails
[19:14:03] orbyt_: has joined #RubyOnRails
[19:16:11] rootsudo: has joined #RubyOnRails
[19:18:14] desperek: has joined #RubyOnRails
[19:23:10] chouhoulis: has joined #RubyOnRails
[19:45:14] agent_white: has joined #RubyOnRails
[19:51:40] prettybTech: has joined #RubyOnRails
[20:03:11] uks: has joined #RubyOnRails
[20:11:57] bonhoeffer: has joined #RubyOnRails
[20:38:34] Turnikov: has joined #RubyOnRails
[20:40:07] cagomez: has joined #RubyOnRails
[20:45:03] prettybT_: has joined #RubyOnRails
[20:59:26] dblessing: has joined #RubyOnRails
[21:15:13] FrostCandy: has joined #RubyOnRails
[21:21:20] Technodrome: has joined #RubyOnRails
[21:41:06] reber: has joined #RubyOnRails
[21:56:03] Radar: Time.zone.parse should do it for you iirc
[21:56:08] Radar: bit of a delay here ;)
[22:13:21] nickjj_: has joined #RubyOnRails
[22:23:16] apeiros: has joined #RubyOnRails
[22:24:47] mikecmpbll: has joined #RubyOnRails
[22:25:19] Turnikov: has joined #RubyOnRails
[22:48:21] tdy: has joined #RubyOnRails
[22:48:23] bonhoeffer: has joined #RubyOnRails
[22:52:38] Technodrome: has joined #RubyOnRails
[23:00:29] eckhardt_: has joined #RubyOnRails
[23:07:50] bonhoeffer: has joined #RubyOnRails
[23:08:15] Technodrome: has joined #RubyOnRails
[23:10:57] anime4christ: has joined #RubyOnRails
[23:12:47] anime4christ: Does anybody know why Rails converts timestamps to local time when they are real columns but doesn't when you do something like SELECT (COALLESCE(processed_at, created_at)) AS custom_at?
[23:13:39] lupine: anime4christ: it doesn't have type information associated with the `custom_at` name
[23:14:11] anime4christ: lupine: Ah. Is there a way to force it to?
[23:14:19] lupine: well, does it give you a `Time` object at-all?
[23:14:33] lupine: mysql, postgres?
[23:14:57] lupine: maybe you can specify a type in the AS part
[23:16:13] anime4christ: OK. I'll try that
[23:16:46] lupine: just guessing TBH
[23:17:46] eckhardt_: has joined #RubyOnRails
[23:19:18] anime4christ: I tried AT TIME ZONE 'UTC' AT TIME ZONE '#{Rails.local_time_zone_config_thing}' before and it didn't work
[23:19:38] anime4christ: Doing a type cast doesn't seem to make a difference either :(
[23:21:27] anime4christ: I suppose I might just resign to using record.custom_at.in_time_zone in all the views/controllers
[23:21:51] anime4christ: It's clunky but it at least works
[23:22:17] roshanavand: has joined #RubyOnRails
[23:22:19] anime4christ: Thanks for the suggestion anyway, lupine
[23:23:17] apeiros: has joined #RubyOnRails
[23:24:32] CheckYourSix: Man I forgot so much stuff in Rails. I was playing with it and building an app over the span of a couple months a few years back. Now I feel like I've never touched it
[23:33:46] anime4christ: Ended up going with this hack: def custom_at; self[:custom_at].in_time_zone; end
[23:35:58] bonhoeffer: has joined #RubyOnRails
[23:45:00] bonhoeffer: has joined #RubyOnRails
[23:46:02] dar123: has joined #RubyOnRails
[23:47:56] anime4christ: has joined #RubyOnRails