« Back to channel list

#RubyOnRails - 12 July 2018

« Back 1 day Forward 1 day »
[00:04:57] fragamus: has joined #RubyOnRails
[00:08:35] jhack: has joined #RubyOnRails
[00:30:40] johndunn: has left #RubyOnRails: ()
[00:40:41] alfiemax: has joined #RubyOnRails
[00:56:54] chouhoulis: has joined #RubyOnRails
[00:59:04] pharma_joe: has joined #RubyOnRails
[00:59:53] jasmith: has joined #RubyOnRails
[01:13:04] sevenseacat: has joined #RubyOnRails
[01:19:49] SteenJobs: been a few hours so figured i’d try again: based on the json api spec, from both the perspective of the backend and the client consuming the api, is there any non-semantic reason why including a related resource, e.g. `comments` on an `article`, in the `relationships` object is advantageous to making it a property on the `article` object itself - specifically in a case where there is no `links` object included?
[01:59:51] pharma_joe: has joined #RubyOnRails
[02:20:20] tdy: has joined #RubyOnRails
[02:38:13] alfiemax: has joined #RubyOnRails
[02:49:48] apeiros: has joined #RubyOnRails
[03:09:48] braincrash: has joined #RubyOnRails
[03:12:43] vedu_: has joined #RubyOnRails
[03:13:45] Technodrome: has joined #RubyOnRails
[03:16:45] hahuang65: SteenJobs: I'll take a stab at it... from the client side, it may be confusing, or difficult to distinguish what is a property and what is a totally separate resource?
[03:17:39] hahuang65: from the backend side (and to a degree, the client side), it means having to attach relational objects onto every response, even if it's not useful there.
[03:18:07] hahuang65: you're obviously not forced to do that, but making that an optional addon that's not visibly a "separate resource" to the client may make it difficult to grok
[03:33:50] sevenseacat: has joined #RubyOnRails
[03:36:57] SteenJobs: hahuang65 much appreciated! yea, i mean that’s what i was originally thinking, but then i also realized that from the client side, even when using `relationships`, the programmer consuming the API still has to know what and how to parse the object when writing a deserializer, so the consumer still needs to know that there’s a `comments` property, whether as a property on the main resource or inside the `relationships` object -
[03:36:58] SteenJobs: granted it helps semantically to place it in the `relationships` object, but i also think it’s pretty clear if the main resource has a property `comments` that is an array of objects that look like `{type: “comment”, id: 50}`, i.e. resource identifier objects
[03:37:13] srinidhi: has joined #RubyOnRails
[03:37:17] SteenJobs: full disclosure i do primarily iOS development now (but used to do rails dev some time back)
[03:38:42] SteenJobs: as for the backend side, i feel like attaching or removing a relational resource to the response inside the `relationships` object is no easier than adding or removing a property on the main object itself, but maybe i’m wrong about that?
[03:38:59] hahuang65: SteenJobs: I mean if it's not publicly consumed, then really all of this has no bearing. If it IS publicly consumed, I would just say, prepare for people to make comments.
[03:39:56] hahuang65: SteenJobs: what you're saying on the backend-side is correct. It's not "technically difficult", but think about the case when you don't want to attach "comments". what do you do? take out the property? leave it as an empty array? set it to a specific value like :not_loaded?
[03:40:09] SteenJobs: privately consumed api, and someone on the backend team started pushing for following the spec, so i took a deep dive and just trying to figure out any non-semantic practical utility for doing things this way
[03:40:10] hahuang65: if you nest it under `relationships` you can easily leave the entire property out
[03:41:02] SteenJobs: but even the root level object is a dict, so why would adding or removing a key/value pair from the root level be different than adding or removing it from inside another dict?
[03:41:19] SteenJobs: not challenging what you said, it sounds right to me, just trying to figure out what i’m missing
[03:42:07] hahuang65: because as a client, I can treat everything under `relationships` as a possible no-show. That's not true if it appears as just another property on the main object. I'd have to write custom code. It's just the benefit of encapsulating it under another key.
[03:43:01] hahuang65: if everything under relationships follows a convention like {object_type: MyObject, id: id}, then you can write a parser that goes through everything in `relationships`. not true if it's just another top-level attribute on the main object.
[03:43:33] SteenJobs: on the client, let’s say somewhere in my code i have `var commentArray = article[“relationships”][“comments”]` or `var commentArray = article[“comments”]` - it seems that either way, the client code will have to account for the possibility of `commentArray` being nil
[03:44:00] hahuang65: SteenJobs: lemme see if I can gin up an example to illustrate what I'm saying
[03:46:09] SteenJobs: hahuang65: thanks a bunch, i’ve been at this all day
[03:49:19] darkhanb: has joined #RubyOnRails
[03:52:16] hahuang65: SteenJobs: https://gist.github.com/hahuang65/dfbafcdb06bcfd08755de13d5a222e40
[03:52:42] hahuang65: idk if that kind of explains it more
[03:54:02] hahuang65: I think in the case of including the relation directly on the main object, you have a lot more explaining in docs to do. When are there no related objects, when are they just not loaded, and which keys refer to relationships rather than just attributes
[03:54:27] hahuang65: if you nest it under "relationships" all of that goes away. it's understood that if it's not there, it's not loaded. if it's there but empty, it's empty.
[03:54:39] hahuang65: and the fact that it's under "relationships" makes it a related object, not an attribute
[03:55:04] hahuang65: sure you can distinguish all of that by inspecting the JSON structure, which is easy for a person, but more difficult to read when you code it up
[03:56:40] hahuang65: SteenJobs: that's my 2 cents on this. The more time I spend coding, the more I believe in the benefit of being explicit for everything.
[04:00:41] SteenJobs: hahuang65: i’ll have to ruminate over it a bit more, but i definitely agree that it’s undoubtedly semantically more clear
[04:01:49] hahuang65: SteenJobs: in the end, if everyone who is affected by this comes to the same understanding, I really don't think it matters. That's how specs are developed anyway, a group of people agreeing on something that makes sense to them.
[04:02:29] hahuang65: I've got to run, but good luck and hope you come to a conclusion that you're happy with SteenJobs :)
[04:03:25] SteenJobs: hahuang65 have some more thoughts on your gist, i’ll keep an eye out for you tomorrow
[04:03:29] SteenJobs: really appreciate it
[04:09:41] fragamus: has joined #RubyOnRails
[04:10:53] chkhanch: has joined #RubyOnRails
[04:28:06] Saukk: has joined #RubyOnRails
[04:40:14] sirensari2: has joined #RubyOnRails
[04:41:06] tdy: has joined #RubyOnRails
[05:02:00] sagax: has joined #RubyOnRails
[05:02:43] andrewray: has joined #RubyOnRails
[05:03:40] alfiemax: has joined #RubyOnRails
[05:07:39] pharma_j_: has joined #RubyOnRails
[05:08:37] srinidhi: has joined #RubyOnRails
[05:12:53] mtkd: has joined #RubyOnRails
[05:13:03] vedu_: has joined #RubyOnRails
[05:13:58] fcser_: has joined #RubyOnRails
[05:41:00] LightStalker: has joined #RubyOnRails
[05:47:26] srinidhi: has joined #RubyOnRails
[05:53:49] armyriad: has joined #RubyOnRails
[06:26:59] chkhanch: has joined #RubyOnRails
[06:28:35] chkhanch: how I can localization some like this %{model_label} in i18n ?
[06:38:23] dionysus69: has joined #RubyOnRails
[06:43:24] psychoslave: has joined #RubyOnRails
[06:49:57] tbuehlmann: chkhanch: do you mean labels generated by a form builder?
[06:59:19] chkhanch: has joined #RubyOnRails
[07:07:57] dionysus69: hey all, can you help me debug this fatal error? https://pastebin.com/qhnTHcFs
[07:08:31] dionysus69: I was under ddos attack and this was popping all the time, attackers were brute forcing sign in page
[07:08:52] dionysus69: I don't know if the password contained invalid byte sequence in UTF-8, because username didn't
[07:10:12] dionysus69: I have found this too by googling https://github.com/whitequark/rack-utf8_sanitizer/ but don't really understand how it works or what the problem is exactly with this fatal error
[07:10:40] jnollette: has joined #RubyOnRails
[07:13:42] DylanJ: has joined #RubyOnRails
[07:17:23] havenwood: dionysus69: looks like an encoding issue with your string: invalid byte sequence in UTF-8
[07:17:33] dionysus69: which string?
[07:17:51] srinidhi: has joined #RubyOnRails
[07:17:58] dionysus69: I cannot reproduce this, I don't know how attacker caused it
[07:19:32] dionysus69: I input this for example in url ?%28t%B3odei%29 but this throws different error
[07:19:52] dionysus69: I added ?%28t%B3odei%29 to username and password and it didn't throw the error I expected
[07:20:03] dionysus69: on sign in page for example
[07:25:38] havenwood: dionysus69: did you change the encoding? Rails uses #blank? all over, and when it's called on a String, #match?
[07:26:10] dionysus69: I use blank all over too :D never met this error
[07:26:29] havenwood: dionysus69: A basic Cloudflare account has decent OWASP rules if you bother to enable them.
[07:26:51] dionysus69: I just added rack-utf8_sanitizer this gem, now the fatal error is supressed when I pass wrong utf in as url or params, but don't know if it will help on next ddos
[07:27:06] havenwood: dionysus69: Is someone fuzzing you with stuff like random encodings and null bytes? Without looking closer I have no clue.
[07:27:10] dionysus69: ok let me check, I am using cloudflare
[07:27:40] dionysus69: dunno, all I could observe is that sign in page was ddossed with random emails and passwords
[07:30:21] Dbugger: has joined #RubyOnRails
[07:30:23] za1b1tsu: has joined #RubyOnRails
[07:38:46] LightStalker: has joined #RubyOnRails
[07:39:59] Technodrome: has joined #RubyOnRails
[07:47:07] srinidhi: has joined #RubyOnRails
[07:54:48] conta: has joined #RubyOnRails
[07:58:17] srinidhi: has joined #RubyOnRails
[08:01:16] mikecmpbll: has joined #RubyOnRails
[08:04:10] Saukk: has joined #RubyOnRails
[08:13:43] Sylario: has joined #RubyOnRails
[08:23:18] lxsameer: has joined #RubyOnRails
[08:24:18] mikecmpb_: has joined #RubyOnRails
[08:25:17] GeorgesLeYeti: has joined #RubyOnRails
[08:27:58] jottr: has joined #RubyOnRails
[08:35:38] lxsameer: has joined #RubyOnRails
[08:42:27] ellcs: has joined #RubyOnRails
[09:14:15] LightStalker: has joined #RubyOnRails
[09:17:35] Puffball: has joined #RubyOnRails
[09:26:37] Ergo: has joined #RubyOnRails
[09:36:54] reber: has joined #RubyOnRails
[09:40:11] reber: has joined #RubyOnRails
[09:45:33] duderonomy: has joined #RubyOnRails
[09:50:27] dj1300: has joined #RubyOnRails
[09:51:40] mikecmpbll: has joined #RubyOnRails
[09:58:05] ur5us: has joined #RubyOnRails
[10:10:54] apeiros: has joined #RubyOnRails
[10:19:55] andywww: has joined #RubyOnRails
[10:23:30] andywww: has left #RubyOnRails: ()
[10:27:17] vedu_: has joined #RubyOnRails
[10:27:50] ellcs: has joined #RubyOnRails
[10:34:54] GodFather: has joined #RubyOnRails
[10:37:42] dionysus69: has joined #RubyOnRails
[10:54:56] conta: has joined #RubyOnRails
[10:55:01] GodFather: has joined #RubyOnRails
[11:09:40] ur5us: has joined #RubyOnRails
[11:13:07] Dbugger: has joined #RubyOnRails
[11:38:20] nzst: has joined #RubyOnRails
[11:40:11] snickers: has joined #RubyOnRails
[11:42:15] jnollette: has joined #RubyOnRails
[11:42:46] vedu_: has joined #RubyOnRails
[11:47:12] flooffster: has joined #RubyOnRails
[11:47:53] flooffster: hello there ! anyone here?
[11:49:26] srinidhi: has joined #RubyOnRails
[11:49:36] tbuehlmann: flooffster: hello there!
[11:52:53] universal: long time no see :D
[11:55:30] flooffster: any experienced RoR developer, with free time, willing to tell me a bit and show me a slight skeleton for an app that I'm trying to make for a homework assignment?
[12:02:32] fragamus: has joined #RubyOnRails
[12:06:05] universal: flooffster: what are you trying to do? what have you tried? where are you stuck? have you read any guides / tutorials?
[12:10:41] flooffster: trying to make a client wrapper for https://worldcup.sfg.io/ . The assignment is to make a rails app that gives back specific matches and events on the corresponding date asked (have a 22page extensive homework pdf for it).
[12:11:00] flooffster: I'm googling and reading since yesterday and can't seem to get a grasp on it all.
[12:12:19] universal: flooffster: so: separate the problem, solve the retrieval of the data from the api first. no need for rails at this point.
[12:12:30] universal: flooffster: you will find plenty of examples online on how to consume a json api
[12:14:43] universal: once you have that, you can think about if you want to persist this information in the database, then you need to think about a database schema for that and create the models. and then you can somewhat easily create the frontend view
[12:14:45] blackcross: has joined #RubyOnRails
[12:15:37] fmcgeough: has joined #RubyOnRails
[12:15:38] flooffster: universal: thanks for the hints and idea. will try to search for a few good guides on how to consume a json api
[12:26:59] nzst: step back and read this https://github.com/estiens/world_cup_json/blob/master/README.md
[12:43:12] vedu_: has joined #RubyOnRails
[12:56:29] za1b1tsu: has joined #RubyOnRails
[13:11:45] dionysus69: I am reading that in order to use sidekiq full app needs to be thread safe
[13:12:15] dionysus69: but which part though, only the parts that sidekiq executes or literally, the whole app?
[13:12:24] fmcgeough: has joined #RubyOnRails
[13:14:43] sevenseacat: has joined #RubyOnRails
[13:29:39] snickers: has joined #RubyOnRails
[13:43:46] uks: has joined #RubyOnRails
[13:52:39] dblessing: has joined #RubyOnRails
[13:52:54] GodFather: has joined #RubyOnRails
[13:52:58] snickers: has joined #RubyOnRails
[14:00:09] RougeR: has joined #RubyOnRails
[14:00:11] RougeR: dont suppose anyones after a ruby dev in the uk?
[14:01:17] desperek: has joined #RubyOnRails
[14:10:15] mikecmpbll: has joined #RubyOnRails
[14:10:46] GodFather: has joined #RubyOnRails
[14:17:45] alfiemax: has joined #RubyOnRails
[14:18:14] Pupeno: has joined #RubyOnRails
[14:18:57] Pupeno: Can I expect the latest mysql2 gem, 0.5.2, to work with MySQL 5? I have MySQL 8 on my dev machine, but the server has MySQL 5.
[14:24:42] conta1: has joined #RubyOnRails
[14:33:20] GodFather: has joined #RubyOnRails
[15:01:08] Technodrome: has joined #RubyOnRails
[15:01:51] SteenJobs: has joined #RubyOnRails
[15:26:48] IanMalcolm: has joined #RubyOnRails
[15:27:00] conta1: has joined #RubyOnRails
[15:30:03] fragamus: has joined #RubyOnRails
[15:31:52] troys: has joined #RubyOnRails
[15:36:46] alfiemax: has joined #RubyOnRails
[15:48:44] Tempesta: has joined #RubyOnRails
[16:07:08] IanMalcolm: has joined #RubyOnRails
[16:08:20] ivanskie: has joined #RubyOnRails
[16:09:29] alfiemax_: has joined #RubyOnRails
[16:15:52] cagomez: has joined #RubyOnRails
[16:21:01] jcarl43: has joined #RubyOnRails
[16:21:27] andrewray: has joined #RubyOnRails
[16:34:07] baweaver: If you're using eslint-scope, be careful, looks like it got compromised: https://github.com/eslint/eslint-scope/issues/39
[16:35:56] baweaver: Looks like it got unpublished, but if you have 3.7.2 be careful
[16:36:34] darkhanb: has joined #RubyOnRails
[16:47:34] alfiemax: has joined #RubyOnRails
[16:51:18] dipnlik: has joined #RubyOnRails
[16:55:12] npgm: has joined #RubyOnRails
[16:58:44] sameerynho: has joined #RubyOnRails
[16:59:01] IanMalcolm: has joined #RubyOnRails
[17:13:17] eckhardt_: has joined #RubyOnRails
[17:16:41] Technodrome: has joined #RubyOnRails
[17:16:43] dviola: has joined #RubyOnRails
[17:16:57] desperek: has joined #RubyOnRails
[17:21:42] mikecmpbll: has joined #RubyOnRails
[17:24:06] andrewray: has joined #RubyOnRails
[17:30:15] alfiemax: has joined #RubyOnRails
[17:30:47] derrekl: has joined #RubyOnRails
[17:34:17] andrewray: has joined #RubyOnRails
[17:39:53] nzst: thanks for the heads up
[17:45:53] snickers: has joined #RubyOnRails
[17:52:10] timdotrb: has joined #RubyOnRails
[17:59:47] ephemer0l: has joined #RubyOnRails
[18:00:51] reber__: has joined #RubyOnRails
[18:10:46] mikecmpbll: has joined #RubyOnRails
[18:11:06] tendencies: has joined #RubyOnRails
[18:18:17] GodFather: has joined #RubyOnRails
[18:22:55] mikecmpbll: has joined #RubyOnRails
[18:36:03] andrewray: has joined #RubyOnRails
[18:36:51] andrewray: has joined #RubyOnRails
[18:37:38] andrewray: has joined #RubyOnRails
[18:38:23] andrewray: has joined #RubyOnRails
[18:39:00] johndunn: has joined #RubyOnRails
[18:39:12] andrewray: has joined #RubyOnRails
[18:39:55] andrewray: has joined #RubyOnRails
[18:40:42] andrewray: has joined #RubyOnRails
[18:41:25] johndunn: has left #RubyOnRails: ()
[18:51:09] viatsko: has joined #RubyOnRails
[19:02:01] alfiemax_: has joined #RubyOnRails
[19:02:50] mikhael_k33hl: has joined #RubyOnRails
[19:03:25] mikhael_k33hl: I'm currently reading this: http://railsapps.github.io/rails-environment-variables.html. And on some part it said to find the line: config.assets.version = '1.0' but I couldn't find it though, what is it for anyway?
[19:07:54] apeiros__: has joined #RubyOnRails
[19:12:04] nzst: you can grep or ack-grep for it
[19:12:37] nzst: cd config; ack "assets.version"
[19:13:46] mikhael_k33hl: nzst: it seems that the guide I'm reading is old, where should I place config.before to initialize my environment variables?
[19:23:53] IanMalcolm: has joined #RubyOnRails
[19:47:00] reber: has joined #RubyOnRails
[19:47:02] reber__: has joined #RubyOnRails
[19:51:36] FLeiXiuS: has joined #RubyOnRails
[19:51:58] FLeiXiuS: How can I destroy a record through the attribute? Model.update
[19:59:05] snickers: has joined #RubyOnRails
[19:59:09] conta1: has joined #RubyOnRails
[20:12:32] duderono_: has joined #RubyOnRails
[20:13:16] nzst: FLeiXiuS: I don't understand your question
[20:13:40] FLeiXiuS: accepts_nested_attributes has _destroy parameters. Is there something similar for batch updating?
[20:16:24] duderonomy: has joined #RubyOnRails
[20:20:08] nzst: maybe an example gist would help get your question answered, it might be because it's late in the day for me, but that's not clicking at all
[20:24:58] IanMalcolm: has joined #RubyOnRails
[20:33:11] FLeiXiuS: params = foo[bar] = {'1': '_destroy': true}
[20:34:17] FLeiXiuS: I'll go ahead with using an array of ids for now.
[20:59:46] eckhardt_: has joined #RubyOnRails
[21:06:34] dmarr: has joined #RubyOnRails
[21:25:58] MasterAsia: has joined #RubyOnRails
[21:26:19] MasterAsia: When I press the back-button, I get shown the results of show.js.erb
[21:26:22] MasterAsia: instead of show.html.erb
[21:32:10] turtlekitty: has joined #RubyOnRails
[21:35:15] turtlekitty: I'm running into this: https://github.com/rails/rails/issues/17368
[21:35:34] turtlekitty: Anyone know of a workaround? I want to temporarily add or subtract associations for preview purposes
[21:40:10] TurtleKitty_: has joined #RubyOnRails
[21:43:42] pharma_joe: has joined #RubyOnRails
[21:48:14] havenwood: has joined #RubyOnRails
[21:54:56] za1b1tsu: has joined #RubyOnRails
[21:58:39] timdotrb_: has joined #RubyOnRails
[22:09:26] timdotrb_: has joined #RubyOnRails
[22:21:33] ivanskie: has joined #RubyOnRails
[22:42:54] Technodrome: has joined #RubyOnRails
[22:50:32] Slogger: has joined #RubyOnRails
[23:12:09] quazimodo: has joined #RubyOnRails
[23:18:13] andrewray: has joined #RubyOnRails
[23:18:35] andrewray: What happens if you both javascript_include_tag jquery, and in another manifest file, //= require jquery ?
[23:19:26] hazulu: has joined #RubyOnRails
[23:21:48] pharma_joe: has joined #RubyOnRails
[23:27:10] SloggerK: has joined #RubyOnRails
[23:28:54] Alec: has joined #RubyOnRails
[23:29:07] Alec: I bet you get a lot of this and I've always wondered
[23:29:39] Alec: WTF is Ruby On Rails - vs Ruby - best I've got is like a HTTP-"framework" that front requests and passes them to Ruby (which I'm checking out :))
[23:30:17] za1b1tsu: has joined #RubyOnRails
[23:39:27] _aeris_: has joined #RubyOnRails
[23:49:56] mikecmpbll: has joined #RubyOnRails
[23:51:39] havenwood: Alec: Ruby is a programming language. That's the easy one.
[23:52:28] Alec: Yeah got that
[23:53:05] havenwood: Alec: Rails is one of many Rack frameworks. Rack is a webserver interface: https://rack.github.io/
[23:54:12] havenwood: Alec: Rack has a specification that allows webservers, middleware and frameworks.
[23:54:31] Alec: I'll look up "Rack" and a bit further.
[23:54:39] Alec: So it is a distinct thing?
[23:54:51] Alec: You know how boost is to C++? RoR is to Ruby?
[23:54:55] havenwood: Alec: You can make a simple Rack app. I highly recommend doing so.
[23:55:07] Alec: Simple to make - hard to maintain
[23:55:30] havenwood: Alec: Making a Rack app you'll quickly see why there are frameworks.
[23:55:53] havenwood: Alec: It gets cumbersome to parse routes yourself and handle headers, etc.
[23:56:49] havenwood: Alec: Rack webserver (Puma, Unicorn, Rainbows!, Thin, Passenger, Reel-Rack, etcetera or default WEBrick.) -> Rack and optional Rack Middleware -> optional Rack adapter (Rails, Roda, Cuba, Lotus, Sinatra, Padrino, NYNY, Hobbit, Ramaze, Camping, Scorched, etcetera.)
[23:57:01] hazulu: havenwood do you know a bit about active storage? :o
[23:57:21] mikecmpb_: has joined #RubyOnRails
[23:57:25] havenwood: hazulu: I've used it. Whatcha wondering?
[23:58:01] havenwood: Alec: Rails uses Puma as the default Rack webserver, which is a good choice.
[23:58:09] havenwood: Alec: Then Rails is the Rack framework.
[23:58:17] Alec: Well at least I know there's no quick answer to it.
[23:58:26] Alec: I'll hang around for now if that's okay
[23:58:36] duderonomy: has joined #RubyOnRails
[23:58:56] havenwood: Alec: These are Hello Worlds in various Rack frameworks: https://github.com/luislavena/bench-micro/tree/master/apps
[23:59:13] havenwood: Alec: You can run a Rack app with: rackup
[23:59:21] havenwood: Alec: The default name for a rackup file is: config.ru
[23:59:40] havenwood: Alec: You can make a one line Rack app. I recommend getting familiar with Rack. It's a nice thing to grok.
[23:59:53] mikecmpbll: has joined #RubyOnRails