« Back to channel list

#RubyOnRails - 22 November 2018

« Back 1 day Forward 1 day »
[00:12:48] segy: has joined #RubyOnRails
[00:17:50] crankhar1er: has joined #RubyOnRails
[00:24:17] segy: has joined #RubyOnRails
[00:38:34] crankhar1er: has joined #RubyOnRails
[00:45:27] lexileo: has joined #RubyOnRails
[00:53:18] Arkantos: has joined #RubyOnRails
[00:59:15] crankhar1er: has joined #RubyOnRails
[01:03:59] sevenseacat: has joined #RubyOnRails
[01:19:59] crankhar1er: has joined #RubyOnRails
[01:21:21] Puffball: has joined #RubyOnRails
[01:26:47] Dimik: has joined #RubyOnRails
[01:34:37] ariedler: has joined #RubyOnRails
[01:38:42] Puffball: has joined #RubyOnRails
[01:40:45] crankhar1er: has joined #RubyOnRails
[01:43:21] dymk: has joined #RubyOnRails
[01:43:38] gavit: has joined #RubyOnRails
[01:43:54] gavit: execjs seems to support nodejs, however I can't find any documentation on how to make nodejs integrate with rails, do I need to add a gem etc, or should I just install nodejs and it should work out of the box
[01:44:08] sevenseacat: works out of the box.
[01:44:40] gavit: sevenseacat: so just install nodjs on the os and I'm done?
[01:44:43] dymk: Hi, I'm using ActiveRecord 5.2 with a fairly custom usecase, and I'm wondering if AR provides any helper methods for encoding arbitrary arrays/strings into something that the underlying database can consume. Example: Encoding ruby [1, 2, 3] into the PG-understandable string "{1,2,3}"
[01:44:48] sevenseacat: yep. try it and see.
[01:45:31] gavit: sevenseacat: ow cool. I was already going to just enable mini_racer and install it with a gem
[01:45:58] dymk: The goal is to write a query kind of like "INSERT INTO table (pkey, array_of_values) VALUES (1, '{1, 2}'), (2, '{3, 4}') ON CONFLICT DO NOTHING"
[01:46:15] dymk: (where those values being inserted are dynamically generated)
[01:46:31] sevenseacat: AR supports array fields natively
[01:47:15] dymk: Sure, internally, but I'm building the SQL string to execute directly
[01:48:16] dymk: There's no support for PG UPSERT in ActiveRecord (without relying on a third party gem, at least)
[01:48:57] sevenseacat: i'd use a third party gem before rolling my own ad-hoc implementation
[01:49:13] dymk: that third party gem doesn't have the requisite flexibility either
[01:49:15] sevenseacat: check how the gem does it
[01:49:22] dymk: to give you an idea of the schema: `table` has to columns, `id :: long int` and `media_ids :: array of binary`
[01:50:11] dymk: I'd like to write a query which finds or creates all models in `table` with a certain ID, and adds a given media_id to the media_ids array on each row
[01:57:26] dymk: sevenseacat: basically, this: https://gist.github.com/dymk/1c62bb3280dcb555d9211ceb8c939e75
[01:58:47] Arkantos: has joined #RubyOnRails
[02:00:28] dymk: so the hard part (or rather, the part I don't want to write) is the code that serializes an array into SQL
[02:01:24] crankhar1er: has joined #RubyOnRails
[02:06:55] Arkantos: has joined #RubyOnRails
[02:18:53] Arkantos: has joined #RubyOnRails
[02:22:06] crankhar1er: has joined #RubyOnRails
[02:32:39] bambanx: has joined #RubyOnRails
[02:42:51] crankhar1er: has joined #RubyOnRails
[02:42:51] Arkantos: has joined #RubyOnRails
[02:50:22] Arkantos: has joined #RubyOnRails
[02:51:10] CGibsonmm: has joined #RubyOnRails
[02:52:36] jaddison: has joined #RubyOnRails
[02:56:49] CGibsonmm: Is there a way to write a simple query that would do something, like ordering a post via the latest comments in a post has_many comments assosiation
[02:58:01] tectonic: has joined #RubyOnRails
[03:02:05] gambl0r3: has joined #RubyOnRails
[03:03:36] crankhar1er: has joined #RubyOnRails
[03:24:16] crankhar1er: has joined #RubyOnRails
[03:35:24] ariedler: has joined #RubyOnRails
[03:43:35] nickjj_: has joined #RubyOnRails
[03:44:59] crankhar1er: has joined #RubyOnRails
[03:50:12] crankhar1er: has joined #RubyOnRails
[04:09:14] TvL2386: has joined #RubyOnRails
[04:09:49] braincrash: has joined #RubyOnRails
[04:11:00] crankhar1er: has joined #RubyOnRails
[04:22:03] jaddison: has joined #RubyOnRails
[04:31:33] crankhar1er: has joined #RubyOnRails
[04:36:02] MoritaShinobu: has joined #RubyOnRails
[04:52:16] crankhar1er: has joined #RubyOnRails
[04:54:43] sevenseacat: has joined #RubyOnRails
[05:05:34] CGibsonmm: has joined #RubyOnRails
[05:14:57] hnanon: has joined #RubyOnRails
[05:19:39] kapil____: has joined #RubyOnRails
[05:21:19] uksio: has joined #RubyOnRails
[05:58:56] sevenseacat: has joined #RubyOnRails
[06:07:29] lomex: has joined #RubyOnRails
[06:42:25] conta: has joined #RubyOnRails
[06:43:59] cnsvc: has joined #RubyOnRails
[06:48:00] reber: has joined #RubyOnRails
[06:48:10] reber__: has joined #RubyOnRails
[06:52:36] hnanon: I want to add a Facebook pixel to the show view of an order, upon order completion. This same show page (with a unique, hard-to-guess slug as the route param is also where the customer goes to check their order status.
[06:52:54] hnanon: I don't want the facebook pixel to trigger every time they check their order status.
[06:53:02] crankhar1er: has joined #RubyOnRails
[06:54:14] hnanon: Should I just show the pixel if the created_at attribute is > Time.now - 5 seconds or so?
[06:59:30] za1b1tsu: has joined #RubyOnRails
[07:07:36] crankhar1er: has joined #RubyOnRails
[07:17:42] Dbugger: has joined #RubyOnRails
[07:23:03] adgtl: Folks.. getting this error
[07:23:06] adgtl: ActionController::InvalidAuthenticityToken in Devise::SessionsController#destroy
[07:23:12] adgtl: Anyone got hint why?
[07:25:51] sevenseacat: seems like an invalid authenticity token
[07:28:11] crankhar1er: has joined #RubyOnRails
[07:34:04] adgtl: sevenseacat yeh.. but that' coming from default view
[07:34:22] adgtl: I don't expect a invalid authenticity token
[07:36:56] FrankD: has joined #RubyOnRails
[07:38:12] KevinSjoberg: has joined #RubyOnRails
[07:47:20] roshanavand: has joined #RubyOnRails
[07:48:54] crankhar1er: has joined #RubyOnRails
[08:09:45] crankhar1er: has joined #RubyOnRails
[08:17:09] ikbenhet: has joined #RubyOnRails
[08:30:23] crankhar1er: has joined #RubyOnRails
[08:38:20] srinidhi: has joined #RubyOnRails
[08:47:27] JamieD: has joined #RubyOnRails
[08:51:12] crankhar1er: has joined #RubyOnRails
[08:56:42] tdy: has joined #RubyOnRails
[09:11:56] crankhar1er: has joined #RubyOnRails
[09:19:30] lxsameer: has joined #RubyOnRails
[09:24:44] jetchisel: has joined #RubyOnRails
[09:32:30] crankhar1er: has joined #RubyOnRails
[09:37:53] ariedler: has joined #RubyOnRails
[09:41:19] Arkentias: has joined #RubyOnRails
[09:44:49] Arkentias: Hey guys! I'm looking for nice ways to serialize objects in my Rails 5 API. I have methods defined for every kind of API responses in my application_controller (respond_ok, respond_forbidden) etc. I'd like the serialization to happen in the controller, before sending the data to "respond_ok". AMS doesn't seem to suite my need since it should be passed to the render method
[09:50:24] Arkentias: I guess I just want to override the to_json method and maybe accept a variable to allow for different levels of serialization per model. I was wondering if maybe something exists by default to do that? Or a nice library?
[09:54:34] dionysus69: has joined #RubyOnRails
[10:12:31] reber: has joined #RubyOnRails
[10:13:09] rien_: has joined #RubyOnRails
[10:22:08] rien_: Hi there, I'm back again :) A friendly reminder that my PR (https://github.com/rails/rails/pull/33957) which has only 45 changed lines in the tests, has again accumulated a merge conflict. Is there a particular person I can poke for this on GitHub? Should I mention all the core devs at once in my PR (if so, what are their usernames)?
[10:22:31] kapil____: has joined #RubyOnRails
[10:23:15] rien_: I know it's just a small bugfix. But with all due respect, I'm starting to feel a little ignored.
[10:27:45] reber__: has joined #RubyOnRails
[10:33:42] srinidhi: has joined #RubyOnRails
[10:44:03] gavit: has joined #RubyOnRails
[10:54:45] tuor: has joined #RubyOnRails
[11:27:19] apparition47: has joined #RubyOnRails
[11:32:43] gregf_: has joined #RubyOnRails
[11:33:37] conta: has joined #RubyOnRails
[11:38:42] ariedler: has joined #RubyOnRails
[11:55:09] ariedler: has joined #RubyOnRails
[12:08:55] lankanmon: has joined #RubyOnRails
[12:24:40] nickjj_: has joined #RubyOnRails
[12:26:00] za1b1tsu: has joined #RubyOnRails
[12:27:59] TiglatePileser: has joined #RubyOnRails
[12:41:27] Arkantos: has joined #RubyOnRails
[13:00:02] DTZUZO: has joined #RubyOnRails
[13:11:46] lomex: has joined #RubyOnRails
[14:26:11] lomex: has joined #RubyOnRails
[14:48:21] JamieD: has joined #RubyOnRails
[15:41:27] conta: has joined #RubyOnRails
[15:48:17] jsc: has joined #RubyOnRails
[15:49:43] status402: has joined #RubyOnRails
[15:51:21] CGibsonmm: has joined #RubyOnRails
[16:08:33] pd09041999: has joined #RubyOnRails
[16:09:45] _aeris_: has joined #RubyOnRails
[16:18:37] reber__: has joined #RubyOnRails
[16:24:19] lexileo: has joined #RubyOnRails
[16:31:34] jaddison: has joined #RubyOnRails
[16:35:27] conta1: has joined #RubyOnRails
[16:55:20] gambl0r3: has joined #RubyOnRails
[16:57:27] pLaTo0n: has joined #RubyOnRails
[17:22:31] crankhar1er: has joined #RubyOnRails
[17:27:19] Saukk: has joined #RubyOnRails
[17:27:42] Dimik: has joined #RubyOnRails
[17:35:05] lxsameer: has joined #RubyOnRails
[17:40:05] mfunkmann: has joined #RubyOnRails
[17:40:44] mfunkmann: has left #RubyOnRails: ()
[17:41:40] _aeris_: has joined #RubyOnRails
[17:56:20] tectonic: has joined #RubyOnRails
[18:09:09] agent_white: has joined #RubyOnRails
[18:20:40] ivanskie: has joined #RubyOnRails
[18:25:36] lxsameer: has joined #RubyOnRails
[18:42:09] dviola: has joined #RubyOnRails
[18:46:54] OrangeManBad: has joined #RubyOnRails
[18:48:09] agent_white: has joined #RubyOnRails
[19:09:41] crankhar1er: has joined #RubyOnRails
[19:13:07] lomex: has joined #RubyOnRails
[19:13:58] ikbenhet: has joined #RubyOnRails
[19:17:05] dymk: Is it possible to define a polymorphic association, but have the _type field be backed by an enum of ints (which map to class name), rather than a string of the class name?
[19:21:11] conta1: has joined #RubyOnRails
[19:22:25] bambanx: has joined #RubyOnRails
[19:30:13] crankhar1er: has joined #RubyOnRails
[19:50:51] crankhar1er: has joined #RubyOnRails
[19:52:40] Dbugger: has joined #RubyOnRails
[19:55:54] bambanx: has joined #RubyOnRails
[19:57:08] hnanon: has joined #RubyOnRails
[20:07:12] crankhar1er: has joined #RubyOnRails
[20:18:23] Dimik: has joined #RubyOnRails
[20:19:37] ur5us: has joined #RubyOnRails
[20:19:58] defsdoor: has joined #RubyOnRails
[20:27:49] crankhar1er: has joined #RubyOnRails
[20:32:09] jaddison: has joined #RubyOnRails
[20:50:02] DTZUZO: has joined #RubyOnRails
[20:53:36] marahin: Hello. I have two tables, both of which have a slug column (friendly id gem). I have a single endpoint that fetches a record that has a given slug, and it should return either table1 or table2 record.
[20:54:09] marahin: Obviously there should be only one candidate, which means, I need to set up validation and a unique index on `slug` column on both of these tables, to make sure that table1.slug does not have a repeated value that already exists in table2.slug (and vice-versa).
[20:54:12] marahin: How do I do that the Rails-way?
[21:06:55] Dbugger: has joined #RubyOnRails
[21:07:27] tdy: has joined #RubyOnRails
[21:23:22] gambl0re: has joined #RubyOnRails
[21:27:51] jaddison: has joined #RubyOnRails
[21:35:29] gambl0r3: has joined #RubyOnRails
[21:48:30] darkhanb: has joined #RubyOnRails
[21:50:16] roshanavand: has joined #RubyOnRails
[22:03:19] uks: has joined #RubyOnRails
[22:22:44] weaksauce: has joined #RubyOnRails
[22:25:05] lomex: has joined #RubyOnRails
[22:33:33] bga57: has joined #RubyOnRails
[22:33:53] shenghi: has joined #RubyOnRails
[22:40:49] gambl0re: has joined #RubyOnRails
[23:08:24] hnanon: has joined #RubyOnRails
[23:12:01] lypsis: has joined #RubyOnRails
[23:32:13] agent_white: has joined #RubyOnRails