#RubyOnRails - 21 February 2019
« Back 1 day Forward 1 day »
[00:05:15] sf_starfox: I remember seeing some website with a nifty search functionality that aggregated documentation from a number of different places
[08:39:53] Psy-Q: i've set debug_exception_response_format to :api and am sending requests with "Content-Type: application/vnd.api+json" but still getting error responses in text/html. what might be the problem?
[10:34:14] Psy-Q: and i still haven't figured out how i can trap RoutingError and give a JSON response
[15:44:19] gaussblurinc1: Hi! I've just updated project to Rails 5.2. How could I add missing output option wrapping by inserting root node "comments" for route /comments.json?
[16:00:56] Net: Could someone explain to me how putting nginx in front of puma helps parallelize requests? Does it involve running multiple puma servers and having nginx balance between them?
[16:07:16] havenwood: Net: Yes, Puma buffers requests and only passes them to a worker when complete.
[16:12:22] havenwood: Net: Nginx can provide HTTP/2 up to Puma. I'm used to setting up SSL with Nginx.
[16:13:16] havenwood: Net: Falcon provides those things out of the box, but it's newer and you'll need to make sure you have async adapters for all your IO stuff.
[16:54:23] Inside: So this is a pretty smelly piece of code. I just don't know to how refactor it or test it.
[16:54:56] Inside: Basically I'm trying to guard against Component's validations changing in the future
[18:10:13] IGnorAND: When doing Company.includes(:addresses).first in console, shouldn't you see the sub-objects as well (in this case all addresses)?
[18:14:51] Inside: https://guides.rubyonrails.org/active_record_querying.html#eager-loading-associations
[18:16:02] Inside: .includes(..) is a hint to preload all of the records associated with the main model(s) instead of loading the associations one by one
[18:16:25] IGnorAND: Inside: thanks, that clears it up. So I'll save when I do a for loop on companies
[18:31:36] IGnorAND: For the insurance I'd like a "select DISTINCT on insurance, ordering it by exp date"
[18:31:58] IGnorAND: my solution for now was to create a view in my db and create a 'seperate model' for this view
[18:36:31] dionysus70: if you have experience with rspec, can you share where did you learn it? if any specific resources of course
[18:41:25] IGnorAND: dionysus70: well, not exactly learn, but I liked this writeup: https://scotch.io/tutorials/build-a-restful-json-api-with-rails-5-part-one After that I tried checking what I did wrong with http://www.betterspecs.org/
[18:43:04] dionysus70: will take a look thanks IGnorAND, yea I checked betterspecs.org before but the information seemed overwhelming without base knowledge.
[18:43:48] IGnorAND: dionysus70: try the scotch.io one. It is more related to API writing with rails though
[18:47:35] IGnorAND: dionysus70: I recently started with vuejs. I like writing complex forms in there better
[18:48:24] dionysus70: yea SPA has its adventages but I find it hard dealing with an extra layer, there are so many layers already
[18:49:28] dionysus70: I've done one such app in emberjs which I liked but overall I spent more time xD
[18:50:06] dionysus70: I dont see problem with bare html + turbolinks hasn't yet created an existential problem for me so it is SPA like performance without one :P
[18:54:25] IGnorAND: @dionysus70 I started with vuejs. I think overall I spend more time as well, but it gets prettier, more responsive and such
[22:00:47] IGnorAND: with polymorphic models like addressable, how do I figure out what to show in the index? @addressable = Company.find(params[:company_id]) or @addressable = Person.find(params[:person_id]), do I do a does param exist?
[22:02:49] IGnorAND: @havenwood /api/v1/companies/:company_id/addresses vs /api/v1/people/:person_id/addresses all come down to the same controller right
[22:03:27] IGnorAND: so for index I do a if(params.has_key?(:company_id) else if (params.has_key?(:person_id)?