« Back to channel list

#RubyOnRails - 29 November 2018

« Back 1 day Forward 1 day »
[00:06:00] Jervis_: has joined #RubyOnRails
[00:22:24] crankhar1er: has joined #RubyOnRails
[01:02:28] orbyt_: has joined #RubyOnRails
[01:07:38] Eaven: has joined #RubyOnRails
[01:11:22] Eaven: Hello I have this model im trying to build a scope for but im having issues with the jsonb column. https://gist.github.com/Eaven/bed643d088f0be1bdaf131a3401892dd i need to where not creator_id nil or provided_creator_id_to_scope, where resolver_id nil, and where not read_confirmations jsonb column contains specific_key
[01:11:58] Eaven: scope :active_issues, -> { where.not(creator_id: nil).where(resolver_id: nil) } is the easy part
[01:12:22] Eaven: well, i dont have the provided_creator_key in there either.. but man that jsonb column is being difficult
[01:13:57] Eaven: ill cashapp a beer for insight :)
[01:15:01] tdy: has joined #RubyOnRails
[01:16:32] Eaven: .where("(read_confirmations #>'{?}') is not null", 1)
[01:16:42] Eaven: ill buy myself a beer :)
[01:21:10] eckhardt_: has joined #RubyOnRails
[01:50:30] lexileo: has joined #RubyOnRails
[02:02:41] glossybrown: has joined #RubyOnRails
[02:23:16] crankhar1er: has joined #RubyOnRails
[02:27:38] glossybrown: has joined #RubyOnRails
[02:30:48] ariedler: has joined #RubyOnRails
[02:31:00] _aeris: has joined #RubyOnRails
[02:34:18] orbyt_: has joined #RubyOnRails
[02:34:36] gambl0re: has joined #RubyOnRails
[02:37:13] NivenHuH: has joined #RubyOnRails
[03:20:58] Exuma: has joined #RubyOnRails
[03:23:48] Saukk: has joined #RubyOnRails
[03:25:37] Fridtjof: has joined #RubyOnRails
[03:28:27] gambl0re: has joined #RubyOnRails
[03:36:03] timdotrb: has joined #RubyOnRails
[03:51:49] jaddison: has joined #RubyOnRails
[03:56:12] darkhanb: has joined #RubyOnRails
[04:10:11] braincrash: has joined #RubyOnRails
[04:17:31] sevenseacat: has joined #RubyOnRails
[04:31:55] ariedler: has joined #RubyOnRails
[05:21:33] uksio: has joined #RubyOnRails
[05:25:46] eckhardt_: has joined #RubyOnRails
[05:33:35] Aherin: has joined #RubyOnRails
[05:39:35] alireza: has joined #RubyOnRails
[05:40:26] alireza: Hey amigos, how would you deal with time-specific records/models in Rails?
[05:40:47] alireza: I mean, for example; I've a reward list that would change every month for a specific gift box
[06:08:10] reber: has joined #RubyOnRails
[06:29:12] segy: has joined #RubyOnRails
[06:29:25] conta: has joined #RubyOnRails
[06:49:31] alireza: has left #RubyOnRails: ()
[06:59:11] Aherin: has joined #RubyOnRails
[07:23:17] buyfn: has joined #RubyOnRails
[07:25:52] srinidhi: has joined #RubyOnRails
[07:26:29] fox_mulder_cp: has joined #RubyOnRails
[07:32:16] srinidhi: has joined #RubyOnRails
[07:37:16] timdotrb: has joined #RubyOnRails
[07:38:09] timdotrb: has joined #RubyOnRails
[07:38:48] timdotrb: has joined #RubyOnRails
[07:39:37] timdotrb: has joined #RubyOnRails
[07:40:22] timdotrb: has joined #RubyOnRails
[07:41:06] timdotrb: has joined #RubyOnRails
[07:41:52] timdotrb: has joined #RubyOnRails
[07:42:41] timdotrb: has joined #RubyOnRails
[07:43:26] timdotrb: has joined #RubyOnRails
[07:57:56] DTZUZO: has joined #RubyOnRails
[08:13:14] Puffball: has joined #RubyOnRails
[08:36:25] gambl0re: has joined #RubyOnRails
[08:42:27] adgtl: Folks do you have any recommended link to implement Stripe payments in Ruby on Rails application
[08:44:09] ariedler: has joined #RubyOnRails
[08:44:59] lexileo: has joined #RubyOnRails
[08:54:54] Radar: adgtl: https://stripe.com/docs/checkout/rails
[08:54:59] Radar: The stripe guides are pretty great :)
[08:55:15] Dbugger: has joined #RubyOnRails
[09:01:43] mikecmpbll: has joined #RubyOnRails
[09:05:12] adgtl: Radar thank you
[09:09:06] kapil____: has joined #RubyOnRails
[09:19:23] DTZUZO: has joined #RubyOnRails
[09:25:49] srinidhi: has joined #RubyOnRails
[09:29:01] lomex: has joined #RubyOnRails
[09:40:35] conta: has joined #RubyOnRails
[09:42:58] Guest21835: has joined #RubyOnRails
[09:45:11] pd09041999: has joined #RubyOnRails
[09:51:27] qwizzy: has joined #RubyOnRails
[09:56:39] marahin: I have two tables: A and B. B belongs_to A, and A has_many :b.
[09:57:06] marahin: How can I make an AR query that would select only those A records, that have NO related B records with B.column_name set to true?
[10:05:34] marahin: for now I have A.where.not(id: A.joins(:bs).where(bs: { column: true }).uniq.pluck(:id))
[10:05:48] marahin: but i bet there's a nicer, one-query way to do this
[10:06:09] jhass: it doesn't render out as one query with a subselect?
[10:06:21] marahin: actually..
[10:06:30] jhass: (which a good RDMS probably rewrites to a join)
[10:07:23] snowy: has joined #RubyOnRails
[10:08:00] jhass: oh, I misread the parens
[10:08:57] marahin: yeah well no
[10:09:13] marahin: first it needs to find Customers which fulfill the coniditon of bs.column = true
[10:09:25] marahin: and then it takes their IDs and puts it in the outer query
[10:13:01] jhass: just turn the .uniq.pluck into .distinct(:id)
[10:14:23] jhass: so it stays a relation and is interpolated as a subquery into the not in
[10:16:32] marahin: oh jeebzus
[10:16:39] marahin: jhass: that's so impressive
[10:16:43] marahin: that it works this way
[10:16:53] marahin: do you have some sources so I can get to know this feature better?
[10:17:11] marahin: I didn't expect it wouldn't have fired the query
[10:17:16] tbuehlmann: note that .distinct(:id) doesn't do what you think it does as it's basically the same as just .distinct
[10:17:18] marahin: more over, i didn't expect it would optimize both :P
[10:17:31] marahin: tbuehlmann: oh.
[10:17:48] marahin: tbuehlmann: wait, does it mean jhass's suggested solution wouldn't work...?
[10:18:00] tbuehlmann: I haven't followed in detail and don't know
[10:18:23] jhass: since id is the only field we want to select in the subquery it's fine
[10:18:47] marahin: i just used .to_sql and it seems fine.
[10:18:50] marahin: that's so awesome :-)
[10:18:56] marahin: thank you jhass!
[10:19:01] jhass: mh, it's indeed undocumented at https://api.rubyonrails.org/classes/ActiveRecord/QueryMethods.html#method-i-where
[10:20:36] tbuehlmann: .distinct works on all the selected columns (which obviously works when only selecting one column). if one want to distinct on one column while selecting more than one, use DISTINCT ON in a select clause
[10:59:44] srinidhi: has joined #RubyOnRails
[11:15:06] conta: has joined #RubyOnRails
[11:15:18] lomex: has joined #RubyOnRails
[11:22:20] jlebrech: has joined #RubyOnRails
[11:24:50] jlebrech: I have a bunch of stubs that i just want to return an empty array, is there a gem to do something like returns_empty('Docker.get_tags', 'Twitter.get_tweets') in rspec
[11:26:25] jlebrech: or should i not stub those and set vcr record: :episodes instead?
[11:29:54] w0rd-driven: has joined #RubyOnRails
[11:30:43] tjbp: has joined #RubyOnRails
[11:32:57] hahuang65: has joined #RubyOnRails
[11:51:11] conta: has joined #RubyOnRails
[11:55:13] ariedler: has joined #RubyOnRails
[11:57:04] DaniG2k: has joined #RubyOnRails
[11:57:12] DaniG2k: hello all. I have a base controller from which I'd like to dynamically define an attr_reader and a helper_method but I haven't been able to do so properly
[11:57:44] DaniG2k: I basically have a BaseAuditsController and then another class that inherits from it, say TerminalAuditsController < BaseAuditsController
[11:57:58] DaniG2k: and I'd like to dynamically define the attr_reader and helper_method
[11:58:03] DaniG2k: on the base class
[11:58:50] DaniG2k: any idea how I can do so?
[12:00:07] roshanavand: has joined #RubyOnRails
[12:04:40] tbuehlmann: DaniG2k: what's the problem exactly? what have you tried?
[12:06:29] DaniG2k: tbuehlmann: I've explained it here: https://stackoverflow.com/questions/53538622/rails-dynamically-add-attr-reader-and-helper-method-to-a-base-controller
[12:06:49] gavit: has joined #RubyOnRails
[12:06:57] DaniG2k: tbuehlmann: I've tried with class_eval { attr_reader resource_name.to_sym }
[12:07:51] DaniG2k: and I tried with instance_eval
[12:07:59] tbuehlmann: why not simply name it @resource?
[12:08:27] DaniG2k: you mean instead of resource_name?
[12:08:29] DaniG2k: yeah same thing
[12:08:38] DaniG2k: it's a name though
[12:08:43] DaniG2k: I get a string
[12:09:37] dslegends: has joined #RubyOnRails
[12:10:18] DaniG2k: oooh I think i get it
[12:10:30] DaniG2k: for the attr_reader I need to do something like
[12:11:00] DaniG2k: define_method resource_name {instance_variable_get "@#{resource_name}"}
[12:11:14] DaniG2k: that would create the reader
[12:11:15] tbuehlmann: I thought of @resource ||= organization.lalala
[12:12:30] tbuehlmann: you could also have a inherited class method that gets called when the base controller is being inherited from, then defining the reader and adding the helper method. but to be honest, this doesn't seem like a good idea to me. it greatly complicates the code, making it harder to read
[12:13:07] DaniG2k: but we have so many controllers that follow the same exact pattern that if I could jsut do this, we'd eliminate a ton of redundant code
[12:13:09] tbuehlmann: you could also just define the set_<audit-type> in each controller (I assume there won't be hundreds of them) and it'd be easy enough
[12:13:52] tbuehlmann: there's also https://github.com/hashrocket/decent_exposure that came to mind, but I never used it
[12:14:27] DaniG2k: simplest would just be to add attr_reader and helper_method on the child
[12:14:59] tbuehlmann: as said, you can do that in an inherited class method
[12:15:13] tbuehlmann: I'll give you an example
[12:18:59] lankanmon: has joined #RubyOnRails
[12:25:45] Croata: has joined #RubyOnRails
[12:28:45] tbuehlmann: DaniG2k: something like this: https://gist.github.com/tbuehlmann/edbcea1f4719cf0d28b236e3d1b372af
[12:29:40] tbuehlmann: but again, I guess I wouldn't do it. this makes things harder to reason about. and if you really want that, decent_exposure might just do that
[12:30:43] tbuehlmann: you might also need to call `super` in self.inherited, btw
[12:31:31] mangold: has joined #RubyOnRails
[12:33:18] roshanavand: has joined #RubyOnRails
[12:34:20] Ergo: has joined #RubyOnRails
[12:39:07] DaniG2k: does inherited always get called?
[12:39:12] DaniG2k: automatically?
[12:40:32] tbuehlmann: instead of having a base controller you could also have a module doing the same thing, whatever you like
[12:42:05] qwizzy: has joined #RubyOnRails
[12:44:44] DaniG2k: base controller is fine
[12:44:48] DaniG2k: thanks, I'll give that a whirl
[13:13:28] Guest21835: has joined #RubyOnRails
[13:26:09] jgpawletko: has joined #RubyOnRails
[13:26:14] Guest21835: has joined #RubyOnRails
[13:29:52] srinidhi: has joined #RubyOnRails
[13:31:58] qwizzy: Hi all! I have a question about rails + trailblazer. Can anyone explain me why does CheckTask.call().success? always return true here: https://dpaste.de/sCyF
[13:35:47] Guest21835: has joined #RubyOnRails
[13:49:51] jhass: never looked at trailblazer before but I can't find where Wrap comes from
[13:55:50] qwizzy: http://trailblazer.to/gems/operation/2.0/api.html#wrap-callable
[13:57:27] crankharder: has joined #RubyOnRails
[14:00:21] jhass: but where is it defined? :/
[14:03:11] qwizzy: you mean in trailblazer code? https://github.com/trailblazer/trailblazer/blob/v2.0.3/lib/trailblazer/operation/wrap.rb
[14:03:16] Guest21835: has joined #RubyOnRails
[14:07:07] jhass: ah it's gone in the master branch
[14:10:44] jhass: ok idk this code is too hard to follow
[14:11:27] jhass: given the note about return values in the docs you linked, maybe something always returns something truthy there and it always stays on the right, idk
[14:14:50] qwizzy: already asked it in trailblazer chat in gitter but still have no answer.. Thanks anyway
[14:14:58] conta1: has joined #RubyOnRails
[14:15:05] GodFather: has joined #RubyOnRails
[14:37:18] tycoon177: good morning, i have a legacy table that i just converted to a rails-friendly naming convention and made it into a model, but the created_at and updated_at columns are not being properly updated. i'm not sure what is causing this, however. the db/schema.rb file appears to be correct. those columns are of type `t.datetime`
[14:37:32] roshanavand: has joined #RubyOnRails
[14:39:44] reber: has joined #RubyOnRails
[14:39:55] jottr: has joined #RubyOnRails
[14:40:41] tycoon177: oops, disregard. it looks like the updated_at did, in fact, just get updated. my bad
[14:51:16] glossybrown: has joined #RubyOnRails
[14:51:47] bambanx: has joined #RubyOnRails
[15:06:41] roshanavand: has joined #RubyOnRails
[15:16:21] timdotrb: has joined #RubyOnRails
[15:27:25] roshanavand1: has joined #RubyOnRails
[15:32:04] lypsis: has joined #RubyOnRails
[15:35:33] za1b1tsu: has joined #RubyOnRails
[15:38:52] glossybrown: has joined #RubyOnRails
[15:45:52] Travis-42_: has joined #RubyOnRails
[15:46:20] Travis-42_: I'm trying to apply an application template to an existing rails application, but it seems like the "after_bundle" sections don't run. Is that expected? Is there an alternative the template can use if I want to be able to create the template to work for both new and existing rails applications?
[15:50:54] eclm: has joined #RubyOnRails
[15:54:01] bambanx: has joined #RubyOnRails
[15:59:38] roshanavand: has joined #RubyOnRails
[16:07:01] glossybrown: has joined #RubyOnRails
[16:19:31] glossybrown: has joined #RubyOnRails
[16:21:51] jaddison: has joined #RubyOnRails
[16:22:00] roshanavand: has joined #RubyOnRails
[16:28:53] jaddison: has joined #RubyOnRails
[16:41:42] conta1: has joined #RubyOnRails
[16:51:23] jaddison: has joined #RubyOnRails
[16:59:26] dviola: has joined #RubyOnRails
[17:02:24] glossybrown: has joined #RubyOnRails
[17:04:55] GodFather: has joined #RubyOnRails
[17:13:07] darkhanb: has joined #RubyOnRails
[17:15:04] jottr: has joined #RubyOnRails
[17:18:53] bambanx: has joined #RubyOnRails
[17:26:10] i4: has joined #RubyOnRails
[17:26:21] i4: Hi there!
[17:26:38] buyfn: has joined #RubyOnRails
[17:28:26] i4: I have a Hash hash_new = {:a {a1: 1, a2: 2}, :c {c1: 1, c2: 2},:b {b1: 1, b2: 2}... How can I split the Hash by key? For example :a and :b to get the new hash_two = {one: {:a{}, :c{}}, two: {:b}} ?
[17:30:05] Exuma: has joined #RubyOnRails
[17:30:20] i4: Any ideas?
[17:33:51] za1b1tsu: has joined #RubyOnRails
[17:37:26] za1b1tsu: has joined #RubyOnRails
[17:48:58] Exuma: has joined #RubyOnRails
[17:49:17] uks: has joined #RubyOnRails
[17:58:56] tdy: has joined #RubyOnRails
[18:07:39] gambl0re: has joined #RubyOnRails
[18:21:55] Jervis_: has joined #RubyOnRails
[18:25:50] srinidhi: has joined #RubyOnRails
[18:31:15] glossybrown: has joined #RubyOnRails
[18:31:26] mikecmpbll: has joined #RubyOnRails
[18:49:33] salasrod: has joined #RubyOnRails
[18:57:08] Exuma: has joined #RubyOnRails
[18:57:16] chouhoulis: has joined #RubyOnRails
[18:58:39] lxsameer: has joined #RubyOnRails
[18:59:41] glossybrown: has joined #RubyOnRails
[19:04:00] eckhardt_: has joined #RubyOnRails
[19:06:04] Puffball: has joined #RubyOnRails
[19:10:25] krawchyk: has joined #RubyOnRails
[19:22:28] gambl0re: has joined #RubyOnRails
[19:24:28] buyfn: has joined #RubyOnRails
[19:27:44] glossybrown: has joined #RubyOnRails
[19:31:07] glossybrown: has joined #RubyOnRails
[20:12:14] havenwood: has joined #RubyOnRails
[20:16:58] Dreamer3: has joined #RubyOnRails
[20:19:22] roses-r-red: has joined #RubyOnRails
[20:20:28] roses-r-red: Anyone point me in direction of some good channels for ruby developing and linux security thankksss
[20:20:40] tubbo: irc is dead
[20:20:57] roses-r-red: but you are alive!
[20:20:59] tubbo: nah i thinK #ruby is still going around. no idea what's up with linux security
[20:21:14] roses-r-red: Whats the deal with irc?
[20:21:21] roses-r-red: been a long time since i've used it ...
[20:22:15] roses-r-red: Well than any cool coding channels...much apprecieated
[20:23:28] abartov: has left #RubyOnRails: ()
[20:32:22] _aeris_: has joined #RubyOnRails
[20:33:59] za1b1tsu: has joined #RubyOnRails
[20:36:55] jaddison: has joined #RubyOnRails
[20:36:57] za1b1tsu: has joined #RubyOnRails
[20:38:24] Dreamer3: has joined #RubyOnRails
[20:44:22] defsdoor: has joined #RubyOnRails
[20:44:57] za1b1tsu: has joined #RubyOnRails
[20:46:35] tubbo: roses-r-red: hah idk a lot of people have moved to slack b/c it's easier for people to jump into
[20:46:52] tubbo: with IRC it's a little convoluted...gotta get an IRC client, connect to a network, deal with netsplits and nickname takeovers, etc.
[20:47:14] roses-r-red: really, irc is way chiller in you terminal... who wants to leave the terminal ... my goodness.
[20:47:20] tubbo: agreed haha
[20:47:39] tubbo: #emacs usually has some good technical discussion
[20:47:46] tubbo: and #git from what i remember
[21:07:14] GodFather: has joined #RubyOnRails
[21:09:09] jaddison: has joined #RubyOnRails
[21:10:59] za1b1tsu: has joined #RubyOnRails
[21:15:39] roshanavand: has joined #RubyOnRails
[21:16:27] _aeris_: has joined #RubyOnRails
[21:31:47] roshanavand: has joined #RubyOnRails
[21:36:11] glossybrown: has joined #RubyOnRails
[21:36:20] roses-r-red: has joined #RubyOnRails
[21:47:32] roshanavand: has joined #RubyOnRails
[22:15:03] shenghi: has joined #RubyOnRails
[22:25:23] tdy: has joined #RubyOnRails
[23:01:58] krawchyk: has joined #RubyOnRails
[23:12:15] gavit: has joined #RubyOnRails
[23:12:45] gavit: has joined #RubyOnRails
[23:22:54] roshanavand: has joined #RubyOnRails
[23:25:33] Dimik: has joined #RubyOnRails
[23:27:40] sonOfRa: has joined #RubyOnRails
[23:34:02] roshanavand: has joined #RubyOnRails
[23:48:44] jenrzzz: has joined #RubyOnRails