#RubyOnRails - 19 February 2019
« Back 1 day Forward 1 day »
[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: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: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.
[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"
[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:28:26] tbuehlmann: if order matters, I personally wouldn't use a hash for that. what about using an array?
[15:20:42] sagax: active record not set and not save field if field has name `password_hash`, strange
[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
[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:38:00] dviola: is there a better way to write this query? https://gist.github.com/diegoviola/8f8fc65cc4580644394f61178456038c
[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?
[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: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.
[19:25:42] dviola: any ideas about how I can refactor this? https://gist.github.com/diegoviola/8f8fc65cc4580644394f61178456038c
[19:27:24] DoctorMonocular: dviola: https://blog.lateral.io/2015/05/full-text-search-in-milliseconds-with-postgresql/
[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:44:05] havenwood: dviola: https://scoutapp.com/blog/how-to-make-text-searches-in-postgresql-faster-with-trigram-similarity
[19:49:25] havenwood: dviola: (concatenating the email, org name and slug strings, which still works with your pattern)
[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: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: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 email@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:16:18] Anubix: Hello, is there some method to change Host and Referrer of net/http request to server?
[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: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: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?