« Back to channel list

#RubyOnRails - 19 February 2019

« Back 1 day Forward 1 day »
[00:00:08] DoctorMonocular: just make sure your hard drive is big enough for the data
[00:00:38] DoctorMonocular: normally the issue with projects like this is that the api you're hitting starts rejecting requests becuase you're hitting it too much or too often or something
[00:01:11] Anubix: it should be the problem case other projets do the same and its working.
[00:01:18] Anubix: shouldnt*
[00:01:39] DoctorMonocular: ok well, then it should all work fine
[00:02:34] DoctorMonocular: for the record though, it seems weird to me that there is an api like this where you can potentially download nearly a tb of data and there's no access control of any kind
[00:02:43] DoctorMonocular: it's possible, of course
[00:03:01] DoctorMonocular: but if I were you I'd check with the api provider to be sure you're doing everything according to how they want it done
[00:03:29] Anubix: maybe there is some limitation, but it will be mostly on my side, cause my server cant handle it. Its a big game and they have really hard servers to control this.
[00:08:48] orbyt_: has joined #RubyOnRails
[00:10:54] Anubix: Is there any json parser which can handle it in batches? Is fine to use jobs?
[00:19:05] WRONgG: has joined #RubyOnRails
[00:25:19] Anubix: havenwood and DoctorMonocular thanks for tips, have a nice rest of the day.
[00:42:31] blackmesa: has joined #RubyOnRails
[00:47:25] blackmesa: has joined #RubyOnRails
[00:52:34] blackmesa1: has joined #RubyOnRails
[00:55:15] se3jay: has joined #RubyOnRails
[01:10:50] blackmesa: has joined #RubyOnRails
[01:14:40] blackmesa: has joined #RubyOnRails
[01:21:00] blackmesa: has joined #RubyOnRails
[01:30:47] knight33: has joined #RubyOnRails
[01:32:48] bruul: has joined #RubyOnRails
[01:42:56] crankharder: has joined #RubyOnRails
[01:46:30] sevenseacat: has joined #RubyOnRails
[01:46:57] tdy: has joined #RubyOnRails
[01:49:50] davidh38: has joined #RubyOnRails
[02:01:11] blackmesa: has joined #RubyOnRails
[02:01:56] bruul: has joined #RubyOnRails
[02:21:27] Saukk: has joined #RubyOnRails
[02:23:32] ariedler: has joined #RubyOnRails
[02:28:27] blackmesa: has joined #RubyOnRails
[02:30:36] blackmesa1: has joined #RubyOnRails
[02:36:09] ariedler: has joined #RubyOnRails
[02:38:57] ariedler: has joined #RubyOnRails
[02:53:02] cagomez: has joined #RubyOnRails
[02:55:51] cagomez: has joined #RubyOnRails
[03:14:34] iAmDecim: has joined #RubyOnRails
[03:32:04] maryo: has joined #RubyOnRails
[03:37:08] knight33: has joined #RubyOnRails
[04:06:16] WRONgG: has joined #RubyOnRails
[04:08:55] braincrash: has joined #RubyOnRails
[04:26:05] tweaks: has joined #RubyOnRails
[04:28:41] bruul: has joined #RubyOnRails
[04:39:35] ariedler: has joined #RubyOnRails
[04:57:27] uks: has joined #RubyOnRails
[04:59:00] Technodrome: has joined #RubyOnRails
[05:06:04] srinidhi: has joined #RubyOnRails
[05:09:57] v01d4lph4: has joined #RubyOnRails
[05:10:15] eckhardt: has joined #RubyOnRails
[05:12:25] tdy: has joined #RubyOnRails
[05:14:26] cagomez: has joined #RubyOnRails
[05:18:37] DTZUZO_: has joined #RubyOnRails
[05:24:12] DTZUZO_: has joined #RubyOnRails
[05:27:38] srinidhi: has joined #RubyOnRails
[05:50:35] prestorium: has joined #RubyOnRails
[05:54:13] uksio: has joined #RubyOnRails
[06:04:09] conta: has joined #RubyOnRails
[06:23:27] salasrod: has joined #RubyOnRails
[06:42:32] catbusters: has joined #RubyOnRails
[06:56:26] conta: has joined #RubyOnRails
[07:28:59] srinidhi: has joined #RubyOnRails
[07:54:14] kapil____: has joined #RubyOnRails
[08:01:31] lankanmon: has joined #RubyOnRails
[08:15:08] Technodrome: has joined #RubyOnRails
[08:21:16] status402: has joined #RubyOnRails
[08:22:35] prestorium: has joined #RubyOnRails
[09:00:19] Technodrome: has joined #RubyOnRails
[09:03:40] segy: has joined #RubyOnRails
[09:04:05] mikecmpbll: has joined #RubyOnRails
[09:21:37] mangold: has joined #RubyOnRails
[09:33:27] dionysus69: has joined #RubyOnRails
[09:57:00] iAmDecim: has left #RubyOnRails: ("ERC (IRC client for Emacs 26.1)")
[10:02:25] lxsameer: has joined #RubyOnRails
[10:12:04] davidh38: has joined #RubyOnRails
[10:30:16] davidh38: has joined #RubyOnRails
[10:32:59] deathwishdave: has joined #RubyOnRails
[10:35:19] srinidhi: has joined #RubyOnRails
[11:06:28] conta1: has joined #RubyOnRails
[11:22:21] cgfbee: has joined #RubyOnRails
[11:32:55] deathwishdave: has joined #RubyOnRails
[11:41:10] drale2k_: has joined #RubyOnRails
[11:48:47] lankanmon: has joined #RubyOnRails
[11:55:31] ariedler: has joined #RubyOnRails
[11:57:01] ariedler: has joined #RubyOnRails
[12:15:55] Linuus: has joined #RubyOnRails
[12:25:43] conta1: has joined #RubyOnRails
[12:32:42] old_relik: has joined #RubyOnRails
[12:33:37] old_relik: is there a way for the a relationship to access the caller assocation? So I have a Prison that has many criminals and if I do "Criminal.first.prison"
[12:34:05] old_relik: Can I somehow acquire the Criminal back from the context of prison?
[12:34:12] old_relik: Like "Criminal.first.prison.criminal"
[12:39:37] tbuehlmann: nope, I don't think so
[13:24:32] mangold: has joined #RubyOnRails
[13:29:14] Linuus: has joined #RubyOnRails
[13:32:37] srinidhi: has joined #RubyOnRails
[13:47:05] conta1: has joined #RubyOnRails
[13:53:43] dslegends: has joined #RubyOnRails
[14:13:35] orbyt_: has joined #RubyOnRails
[14:22:49] GeorgesLeYeti: has joined #RubyOnRails
[14:24:54] GeorgesLeYeti: I have an hash and an array of keys. I want to keep in my hash only the items with the keys present in my array. (This is done : https://gist.github.com/GeorgesLeYeti/d7c44907e7538b384ed68f0fb74a8b0e )
[14:25:16] GeorgesLeYeti: But I also want to reorder my hash like my array
[14:25:25] GeorgesLeYeti: And I don't know how to do that
[14:28:26] tbuehlmann: if order matters, I personally wouldn't use a hash for that. what about using an array?
[14:35:00] ams__: has joined #RubyOnRails
[15:00:33] jobewan: has joined #RubyOnRails
[15:09:00] Inside: has joined #RubyOnRails
[15:12:45] ss942: has left #RubyOnRails: ()
[15:19:46] sagax: has joined #RubyOnRails
[15:20:19] sagax: why activerecord 5 not work with field `password_hash` ?
[15:20:42] sagax: active record not set and not save field if field has name `password_hash`, strange
[15:23:41] mello: has joined #RubyOnRails
[15:24:14] mello: good afternoon, hope everyone is doing well
[15:27:02] mello: I have a issue i cant wrap my head around, im building a rails api and i need to implement some sort of permission, but the way it has to work is like this. the admin should be able form the client wich is written i angular, see the users and the check what routes tehy can access. But also be able to create roles dynamicly from the client
[15:30:33] sagax: strange, when i set attribute with `self.some_attribute = some_value` it's not saved, but if i set attribute with `write_attribute(:some_attrubute, some_value)` it's work
[15:46:14] szulak_: has joined #RubyOnRails
[15:46:45] sagax: uff, it's my bad, all ok
[15:58:42] orbyt_: has joined #RubyOnRails
[16:01:11] MrCrackPotBuilde: has joined #RubyOnRails
[16:05:12] asciiwarrior7: has joined #RubyOnRails
[16:07:17] bruul: has joined #RubyOnRails
[16:12:00] agent_white: has joined #RubyOnRails
[16:19:14] AGMS: has joined #RubyOnRails
[16:25:03] [Butch]: has joined #RubyOnRails
[16:31:45] timwis: Hey folks, I'd like to install devise on a project but *only* use it for OmniAuth. Is there a way to skip it installing all the templates/routes/etc. for registering/resetting password, etc.?
[16:33:51] mr-spoon: has joined #RubyOnRails
[16:35:08] dviola: has joined #RubyOnRails
[16:36:41] srinidhi: has joined #RubyOnRails
[16:38:00] dviola: is there a better way to write this query? https://gist.github.com/diegoviola/8f8fc65cc4580644394f61178456038c
[16:38:09] dviola: preferably without the sql string
[16:38:52] JJonah: has joined #RubyOnRails
[16:43:13] JJonah: Is it possible to configure rails so that every variable output in any view is automatically escaped to be safe against XSS attacks? essentially the equivalent of manually calling `sanitize` on every string you display in a view?
[16:45:27] hellekin: has joined #RubyOnRails
[16:54:06] KeyJoo: has joined #RubyOnRails
[16:54:55] skryking: has joined #RubyOnRails
[17:01:02] Net: how can I ensure rails will load a module in dev
[17:03:57] LightStalker: has joined #RubyOnRails
[17:22:52] DoctorMonocular: has joined #RubyOnRails
[17:24:06] DoctorMonocular: hey quick question -- is there a enumerable method that does something like select and reject at the same time? Or like unzipping a collection? The behavior would be like "select where .red?" and the method would return all the red things and it would also return all the not red things?
[17:24:27] knight33: has joined #RubyOnRails
[17:24:28] DoctorMonocular: red, not_red = marbles.separate(&:red?)
[17:24:31] DoctorMonocular: something like that
[17:27:10] davidh38: has joined #RubyOnRails
[17:31:39] drale2k_: has joined #RubyOnRails
[17:32:40] JJonah: so it looks like rails has been sanitizing all view output by default since rails 3. yet in our applicaton we were able to perform a XSS attack by outputing `<script>alert('test')</script>` in a haml view. we did not use html_safe. what would cause it _not_ to be sanitized? we're using rails 5.1.5.
[17:32:46] DTZUZO_: has joined #RubyOnRails
[17:32:57] Inside: DoctorMonocular: partition?
[17:33:05] Inside: marbles.partitionin
[17:33:14] Inside: marbles.partition { |marlble| marble.red/ }
[17:33:16] Inside: marbles.partition { |marlble| marble.red? }
[17:33:28] DoctorMonocular: hah, I thought there might be something!
[17:33:30] tdy: has joined #RubyOnRails
[17:33:30] DoctorMonocular: amazing, thanks
[17:33:58] Inside: ruby: It just works(tm) except when it doesn't
[17:38:28] defsdoor: has joined #RubyOnRails
[17:53:32] tdy: has joined #RubyOnRails
[18:08:51] szulak_: has joined #RubyOnRails
[18:13:06] Linuus: has joined #RubyOnRails
[18:19:14] Linuus: has joined #RubyOnRails
[18:27:28] hellekin: has joined #RubyOnRails
[18:28:27] bruul: has joined #RubyOnRails
[18:44:22] SteenJobs: has joined #RubyOnRails
[18:45:22] conta: has joined #RubyOnRails
[18:53:03] lxsameer: has joined #RubyOnRails
[18:58:29] prestorium: has joined #RubyOnRails
[19:00:38] orbyt_: has joined #RubyOnRails
[19:25:42] dviola: any ideas about how I can refactor this? https://gist.github.com/diegoviola/8f8fc65cc4580644394f61178456038c
[19:25:55] dviola: I don't like the @sql var
[19:27:24] DoctorMonocular: dviola: https://blog.lateral.io/2015/05/full-text-search-in-milliseconds-with-postgresql/
[19:28:34] dviola: DoctorMonocular: thanks, I'll take a look
[19:42:28] havenwood: dviola: Would you mind allowing for typos, etc, or do you really only want perfect matches anywhere in the text?
[19:42:37] orbyt_: has joined #RubyOnRails
[19:43:24] havenwood: dviola: Postgres pg_trgm Trigrams with indexes work great with Rails
[19:43:48] havenwood: dviola: https://www.postgresql.org/docs/current/pgtrgm.html
[19:44:05] havenwood: dviola: https://scoutapp.com/blog/how-to-make-text-searches-in-postgresql-faster-with-trigram-similarity
[19:46:34] szulak_: has joined #RubyOnRails
[19:46:40] havenwood: dviola: Or a straightup refactor would be to use `||` with your code.
[19:48:19] havenwood: dviola: sql = "email || organizations.name || organizations.slug LIKE :query"
[19:49:25] havenwood: dviola: (concatenating the email, org name and slug strings, which still works with your pattern)
[19:56:25] DoctorMonocular: yeah it's a little kludgy but not too bad
[19:56:36] DoctorMonocular: plus you could make it dynamic
[19:57:02] DoctorMonocular: like %w(email, organizations.name, foo, bar).join(' || ')
[19:59:05] FastJack: has joined #RubyOnRails
[20:01:05] dviola: havenwood: I don't mind allowing typos, but for now perfect matches are fine
[20:01:41] dviola: thanks havenwood and DoctorMonocular
[20:02:58] kevinburke: has joined #RubyOnRails
[20:06:14] SteenJobs: has joined #RubyOnRails
[20:22:54] Technodrome: has joined #RubyOnRails
[20:29:32] ur5us: has joined #RubyOnRails
[20:31:09] agent_white: has joined #RubyOnRails
[20:58:34] orbyt_: has joined #RubyOnRails
[21:24:46] gambl0r3: has joined #RubyOnRails
[21:45:10] bruul: has joined #RubyOnRails
[21:59:01] hive-mind: has joined #RubyOnRails
[22:28:00] orbyt_: has joined #RubyOnRails
[22:29:27] SteenJobs: has joined #RubyOnRails
[22:34:31] sf_starfox: has joined #RubyOnRails
[22:35:47] bruul: is there a way to make learning rails feel less like grating my brain?
[22:39:25] sf_starfox: Hi guys - I'm building a system that is going to implement a sortof "If this then that" functionality depending on messages coming in. So say, when we receive a message with a certain keyword, the user can select an action to happen automatically: eg. forward the contents of the message to a certain email. I'm trying to figure out the best way to model this. Is there a design pattern you guys
[22:39:31] sf_starfox: think could be useful for something like this?
[22:44:52] havenwood: bruul: Do you know Ruby well?
[22:45:40] havenwood: sf_starfox: Have you considered a state machine?
[22:46:08] havenwood: sf_starfox: https://www.ruby-toolbox.com/categories/state_machines
[22:46:44] havenwood: sf_starfox: I've used AASM with Rails and it seemed nice.
[22:58:21] orbyt_: has joined #RubyOnRails
[22:59:46] sf_starfox: havenwood: have not looked into using a state machine. One of the main requirements would be to easily add new 'automatic actions'.
[23:01:08] havenwood: sf_starfox: In AASM, state transitions can have callbacks, which should work well to express that: https://github.com/aasm/aasm#callbacks
[23:02:54] sf_starfox: havenwood: reading through the documentation right now. Thanks.
[23:09:03] sf_starfox: havenwood: Thanks for the pointer, I think this will be useful in a number of places for me. But I'm not sure it applies to this task.
[23:09:33] havenwood: sf_starfox: Say more about this task? When you say "message", what do you mean?
[23:09:53] sf_starfox: havenwood: my app helps small businesses with support via text message. And I'm trying to provide them with a functionality similar to Filters on Gmail
[23:11:17] sf_starfox: havenwood: on gmail you can create filters by keywords, that allow you to do things like: If an email with the keyword "alabama" arrives, add the "Southern Region" tag to it
[23:12:27] sf_starfox: havenwood: or you can say: if an email with the keyword "alabama" arrives, forward it to mike@example.com
[23:13:05] sf_starfox: I'm essentially trying the feature of "automatic actions" based on certain tags and keywords
[23:13:41] sf_starfox: and I want this to be extensible so that in the future I can increase the number of automatic actions available to my users
[23:14:32] havenwood: sf_starfox: So so something like a Message has many Filters through User?
[23:15:09] Anubix: has joined #RubyOnRails
[23:15:38] havenwood: sf_starfox: Do you save the Message to the DB?
[23:16:09] havenwood: Or I guess that might depend on a Filter? :)
[23:16:18] Anubix: Hello, is there some method to change Host and Referrer of net/http request to server?
[23:16:39] havenwood: Anubix: You might have better luck with that one in the #ruby channel.
[23:17:05] Anubix: I went throught this https://ruby-doc.org/stdlib-2.1.3/libdoc/net/http/rdoc/Net/HTTP.html and found nothing :)
[23:18:37] Anubix: havenwood: ty i will try
[23:19:45] sf_starfox: havenwood: a message is a pice of text. So we receive a message on our system, then we check if it matches against any of the filters, then trigger automatic actions in case it matches
[23:24:14] havenwood: Anubix: (Answered you there.)
[23:25:26] havenwood: sf_starfox: So you're going to save the Filters to the DB, one set per User? And you're looking for a pattern for iterating through a User's Filters when they get a message?
[23:38:57] dennismo: has joined #RubyOnRails
[23:40:12] dennismo: Hi, just joined channel looking to improve my rails skills.
[23:41:48] havenwood: denn, welcome!
[23:42:26] dennismo: has joined #RubyOnRails
[23:47:51] sf_starfox: havenwood: yes, pretty much.